[
  {
    "path": ".gitignore",
    "content": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n##\n## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore\n\n# User-specific files\n*.suo\n*.user\n*.userosscache\n*.sln.docstates\n\n# User-specific files (MonoDevelop/Xamarin Studio)\n*.userprefs\n\n# Build results\n[Dd]ebug/\n[Dd]ebugPublic/\n[Rr]elease/\n[Rr]eleases/\nx64/\nx86/\nbld/\n[Bb]in/\n[Oo]bj/\n[Ll]og/\n\n# Visual Studio 2015 cache/options directory\n.vs/\n# Uncomment if you have tasks that create the project's static files in wwwroot\n#wwwroot/\n\n# MSTest test Results\n[Tt]est[Rr]esult*/\n[Bb]uild[Ll]og.*\n\n# NUNIT\n*.VisualState.xml\nTestResult.xml\n\n# Build Results of an ATL Project\n[Dd]ebugPS/\n[Rr]eleasePS/\ndlldata.c\n\n# Benchmark Results\nBenchmarkDotNet.Artifacts/\n\n# .NET Core\nproject.lock.json\nproject.fragment.lock.json\nartifacts/\n**/Properties/launchSettings.json\n\n*_i.c\n*_p.c\n*_i.h\n*.ilk\n*.meta\n*.obj\n*.pch\n*.pdb\n*.pgc\n*.pgd\n*.rsp\n*.sbr\n*.tlb\n*.tli\n*.tlh\n*.tmp\n*.tmp_proj\n*.log\n*.vspscc\n*.vssscc\n.builds\n*.pidb\n*.svclog\n*.scc\n\n# Chutzpah Test files\n_Chutzpah*\n\n# Visual C++ cache files\nipch/\n*.aps\n*.ncb\n*.opendb\n*.opensdf\n*.sdf\n*.cachefile\n*.VC.db\n*.VC.VC.opendb\n\n# Visual Studio profiler\n*.psess\n*.vsp\n*.vspx\n*.sap\n\n# TFS 2012 Local Workspace\n$tf/\n\n# Guidance Automation Toolkit\n*.gpState\n\n# ReSharper is a .NET coding add-in\n_ReSharper*/\n*.[Rr]e[Ss]harper\n*.DotSettings.user\n\n# JustCode is a .NET coding add-in\n.JustCode\n\n# TeamCity is a build add-in\n_TeamCity*\n\n# DotCover is a Code Coverage Tool\n*.dotCover\n\n# AxoCover is a Code Coverage Tool\n.axoCover/*\n!.axoCover/settings.json\n\n# Visual Studio code coverage results\n*.coverage\n*.coveragexml\n\n# NCrunch\n_NCrunch_*\n.*crunch*.local.xml\nnCrunchTemp_*\n\n# MightyMoose\n*.mm.*\nAutoTest.Net/\n\n# Web workbench (sass)\n.sass-cache/\n\n# Installshield output folder\n[Ee]xpress/\n\n# DocProject is a documentation generator add-in\nDocProject/buildhelp/\nDocProject/Help/*.HxT\nDocProject/Help/*.HxC\nDocProject/Help/*.hhc\nDocProject/Help/*.hhk\nDocProject/Help/*.hhp\nDocProject/Help/Html2\nDocProject/Help/html\n\n# Click-Once directory\npublish/\n\n# Publish Web Output\n*.[Pp]ublish.xml\n*.azurePubxml\n# Note: Comment the next line if you want to checkin your web deploy settings,\n# but database connection strings (with potential passwords) will be unencrypted\n*.pubxml\n*.publishproj\n\n# Microsoft Azure Web App publish settings. Comment the next line if you want to\n# checkin your Azure Web App publish settings, but sensitive information contained\n# in these scripts will be unencrypted\nPublishScripts/\n\n# NuGet Packages\n*.nupkg\n# The packages folder can be ignored because of Package Restore\n**/packages/*\n# except build/, which is used as an MSBuild target.\n!**/packages/build/\n# Uncomment if necessary however generally it will be regenerated when needed\n#!**/packages/repositories.config\n# NuGet v3's project.json files produces more ignorable files\n*.nuget.props\n*.nuget.targets\n\n# Microsoft Azure Build Output\ncsx/\n*.build.csdef\n\n# Microsoft Azure Emulator\necf/\nrcf/\n\n# Windows Store app package directories and files\nAppPackages/\nBundleArtifacts/\nPackage.StoreAssociation.xml\n_pkginfo.txt\n*.appx\n\n# Visual Studio cache files\n# files ending in .cache can be ignored\n*.[Cc]ache\n# but keep track of directories ending in .cache\n!*.[Cc]ache/\n\n# Others\nClientBin/\n~$*\n*~\n*.dbmdl\n*.dbproj.schemaview\n*.jfm\n*.pfx\n*.publishsettings\norleans.codegen.cs\n\n# Since there are multiple workflows, uncomment next line to ignore bower_components\n# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)\n#bower_components/\n\n# RIA/Silverlight projects\nGenerated_Code/\n\n# Backup & report files from converting an old project file\n# to a newer Visual Studio version. Backup files are not needed,\n# because we have git ;-)\n_UpgradeReport_Files/\nBackup*/\nUpgradeLog*.XML\nUpgradeLog*.htm\n\n# SQL Server files\n*.mdf\n*.ldf\n*.ndf\n\n# Business Intelligence projects\n*.rdl.data\n*.bim.layout\n*.bim_*.settings\n\n# Microsoft Fakes\nFakesAssemblies/\n\n# GhostDoc plugin setting file\n*.GhostDoc.xml\n\n# Node.js Tools for Visual Studio\n.ntvs_analysis.dat\nnode_modules/\n\n# Typescript v1 declaration files\ntypings/\n\n# Visual Studio 6 build log\n*.plg\n\n# Visual Studio 6 workspace options file\n*.opt\n\n# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)\n*.vbw\n\n# Visual Studio LightSwitch build output\n**/*.HTMLClient/GeneratedArtifacts\n**/*.DesktopClient/GeneratedArtifacts\n**/*.DesktopClient/ModelManifest.xml\n**/*.Server/GeneratedArtifacts\n**/*.Server/ModelManifest.xml\n_Pvt_Extensions\n\n# Paket dependency manager\n.paket/paket.exe\npaket-files/\n\n# FAKE - F# Make\n.fake/\n\n# JetBrains Rider\n.idea/\n*.sln.iml\n\n# CodeRush\n.cr/\n\n# Python Tools for Visual Studio (PTVS)\n__pycache__/\n*.pyc\n\n# Cake - Uncomment if you are using it\n# tools/**\n# !tools/packages.config\n\n# Tabs Studio\n*.tss\n\n# Telerik's JustMock configuration file\n*.jmconfig\n\n# BizTalk build output\n*.btp.cs\n*.btm.cs\n*.odx.cs\n*.xsd.cs"
  },
  {
    "path": "CoreIntegrationTests/App.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  For more information on how to configure your ASP.NET application, please visit\n  http://go.microsoft.com/fwlink/?LinkId=169433\n  -->\n<configuration>\n  <connectionStrings>\n    <add name=\"MongoDbTests\" connectionString=\"mongodb://localhost:27017\" />\n  </connectionStrings>\n</configuration>"
  },
  {
    "path": "CoreIntegrationTests/CRUDObjectIdTests.cs",
    "content": "﻿using CoreIntegrationTests.Infrastructure;\nusing MongoDB.Bson;\n\nnamespace CoreIntegrationTests\n{\n    public class CoreObjectIdTestDocument : TestDoc<ObjectId>\n    {\n    }\n\n    public class CRUDObjectIdTests : MongoDbTKeyDocumentTestBase<CoreObjectIdTestDocument, ObjectId>\n    {\n        public CRUDObjectIdTests(MongoDbTestFixture<CoreObjectIdTestDocument, ObjectId> fixture) : base(fixture)\n        {\n\n        }\n\n        public override string GetClassName()\n        {\n            return \"CRUDObjectIdTests\";\n        }\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/CRUDPartitionedCollectionNameAttributeTests.cs",
    "content": "﻿using CoreIntegrationTests.Infrastructure;\nusing MongoDbGenericRepository.Attributes;\nusing MongoDbGenericRepository.Models;\nusing System;\n\nnamespace CoreIntegrationTests\n{\n    [CollectionName(\"CoreTestingCNameAttrPart\")]\n    public class CorePartitionedCollectionNameDoc : TestDoc, IPartitionedDocument\n    {\n        public CorePartitionedCollectionNameDoc()\n        {\n            PartitionKey = \"CoreTestPartitionKeyCollectionName\";\n        }\n\n        public string PartitionKey { get; set; }\n    }\n\n    public class CRUDPartitionedCollectionNameAttributeTests : MongoDbDocumentTestBase<CorePartitionedCollectionNameDoc>\n    {\n        public CRUDPartitionedCollectionNameAttributeTests(MongoDbTestFixture<CorePartitionedCollectionNameDoc, Guid> fixture) : base(fixture)\n        {\n\n        }\n\n        public override string GetClassName()\n        {\n            return \"CoreCRUDPartitionedCollectionNameAttributeTests\";\n        }\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/CRUDPartitionedTests.cs",
    "content": "﻿using CoreIntegrationTests.Infrastructure;\nusing MongoDbGenericRepository.Models;\nusing System;\n\nnamespace CoreIntegrationTests\n{\n    public class CorePartitionedDoc : TestDoc, IPartitionedDocument\n    {\n        public CorePartitionedDoc()\n        {\n            PartitionKey = \"CoreTestPartitionKey\";\n        }\n\n        public string PartitionKey { get; set; }\n    }\n\n    public class CRUDPartitionedTests : MongoDbDocumentTestBase<CorePartitionedDoc>\n    {\n        public CRUDPartitionedTests(MongoDbTestFixture<CorePartitionedDoc, Guid> fixture) : base(fixture)\n        {\n        }\n\n        public override string GetClassName()\n        {\n            return \"CoreCRUDPartitionedTests\";\n        }\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/CRUDTKeyPartitionedCollectionNameAttributeTests.cs",
    "content": "﻿using CoreIntegrationTests.Infrastructure;\nusing MongoDB.Bson;\nusing MongoDbGenericRepository.Attributes;\nusing MongoDbGenericRepository.Models;\nusing System;\n\nnamespace CoreIntegrationTests\n{\n    #region Guid Type \n\n    [CollectionName(\"TestingCNameAttrPartTKey\")]\n    public class CoreTKeyPartitionedCollectionNameDoc : TestDoc<Guid>, IPartitionedDocument\n    {\n        public CoreTKeyPartitionedCollectionNameDoc()\n        {\n            PartitionKey = \"CoreTestPartitionKey\";\n        }\n\n        public string PartitionKey { get; set; }\n    }\n\n    public class CRUDTKeyPartitionedCollectionNameAttributeTests : MongoDbTKeyDocumentTestBase<CoreTKeyPartitionedCollectionNameDoc, Guid>\n    {\n        public CRUDTKeyPartitionedCollectionNameAttributeTests(MongoDbTestFixture<CoreTKeyPartitionedCollectionNameDoc, Guid> fixture) : base(fixture)\n        {\n\n        }\n\n        public override string GetClassName()\n        {\n            return \"CoreCRUDTKeyPartitionedCollectionNameAttributeTests\";\n        }\n    }\n\n    #endregion Guid Type\n\n\n    #region ObjectId Type\n\n    [CollectionName(\"TestingCNameAttrPartObjectId\")]\n    public class CoreObjectIdPartitionedCollectionNameDoc : TestDoc<ObjectId>, IPartitionedDocument\n    {\n        public CoreObjectIdPartitionedCollectionNameDoc()\n        {\n            PartitionKey = \"CoreTestPartitionKeyObjectId\";\n        }\n\n        public string PartitionKey { get; set; }\n    }\n\n    public class CRUDObjectIdPartitionedCollectionNameAttributeTests : MongoDbTKeyDocumentTestBase<CoreObjectIdPartitionedCollectionNameDoc, ObjectId>\n    {\n        public CRUDObjectIdPartitionedCollectionNameAttributeTests(MongoDbTestFixture<CoreObjectIdPartitionedCollectionNameDoc, ObjectId> fixture) : base(fixture)\n        {\n\n        }\n\n        public override string GetClassName()\n        {\n            return \"CoreCRUDTKeyPartitionedCollectionNameAttributeTests\";\n        }\n    }\n\n    #endregion ObjectId Type\n}\n"
  },
  {
    "path": "CoreIntegrationTests/CRUDTKeyPartitionedTests.cs",
    "content": "﻿using CoreIntegrationTests.Infrastructure;\nusing MongoDbGenericRepository.Models;\nusing System;\n\nnamespace CoreIntegrationTests\n{\n    public class CorePartitionedTKeyTestDocument : TestDoc<Guid>, IPartitionedDocument\n    {\n        public CorePartitionedTKeyTestDocument()\n        {\n            PartitionKey = \"CoreTestPartitionKey\";\n        }\n        public string PartitionKey { get; set; }\n    }\n\n    public class CRUDTKeyPartitionedTests : MongoDbTKeyDocumentTestBase<CorePartitionedTKeyTestDocument, Guid>\n    {\n        public CRUDTKeyPartitionedTests(MongoDbTestFixture<CorePartitionedTKeyTestDocument, Guid> fixture) : base(fixture)\n        {\n\n        }\n\n        public override string GetClassName()\n        {\n            return \"CoreCRUDTKeyPartitionedTests\";\n        }\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/CRUDTKeyTests.cs",
    "content": "﻿using CoreIntegrationTests.Infrastructure;\nusing System;\n\nnamespace CoreIntegrationTests\n{\n    public class CoreTKeyTestDocument : TestDoc<Guid>\n    {\n    }\n\n    public class CRUDTKeyTests : MongoDbTKeyDocumentTestBase<CoreTKeyTestDocument, Guid>\n    {\n        public CRUDTKeyTests(MongoDbTestFixture<CoreTKeyTestDocument, Guid> fixture) : base(fixture)\n        {\n\n        }\n\n        public override string GetClassName()\n        {\n            return \"CreateTKeyTests\";\n        }\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/CRUDTests.cs",
    "content": "﻿using CoreIntegrationTests.Infrastructure;\nusing System;\n\nnamespace CoreIntegrationTests\n{\n    public class CoreTestDocument : TestDoc\n    {\n    }\n\n    public class CRUDTests : MongoDbDocumentTestBase<CoreTestDocument>\n    {\n        public CRUDTests(MongoDbTestFixture<CoreTestDocument, Guid> fixture) : base(fixture)\n        {\n        }\n\n        public override string GetClassName()\n        {\n            return \"CRUDTests\";\n        }\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/CoreIntegrationTests.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFramework>net8.0</TargetFramework>\n\t<Nullable>disable</Nullable>\n\t<ImplicitUsings>enable</ImplicitUsings>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"Microsoft.Extensions.Identity.Stores\" Version=\"[8.*,9)\" />\n    <PackageReference Include=\"xunit\" Version=\"2.9.2\" />\n    <PackageReference Include=\"xunit.runner.console\" Version=\"2.9.2\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>\n    </PackageReference>\n    <PackageReference Include=\"xunit.runner.visualstudio\" Version=\"2.8.2\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n    </PackageReference>\n\t<PackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"17.*\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <None Update=\"App.config\">\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </None>\n  </ItemGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\MongoDbGenericRepository\\MongoDbGenericRepository.csproj\" />\n  </ItemGroup>\n\n</Project>"
  },
  {
    "path": "CoreIntegrationTests/IdentityUserTests.cs",
    "content": "﻿using CoreIntegrationTests.Infrastructure;\nusing MongoDbGenericRepository.Models;\nusing System;\nusing System.Collections.Generic;\nusing Xunit;\nusing Microsoft.AspNetCore.Identity;\nusing System.Threading.Tasks;\n\nnamespace CoreIntegrationTests\n{\n    public class MongoIdentityUser<TKey> : IdentityUser<TKey>, IDocument<TKey>\n        where TKey : IEquatable<TKey>\n    {\n        public int Version { get; set; }\n    }\n\n    public class IdentityUserTest : MongoIdentityUser<Guid>, IDocument<Guid>\n    {\n        public IdentityUserTest()\n        {\n            Id = Guid.NewGuid();\n            Version = 2;\n        }\n        public string SomeContent { get; set; }\n    }\n\n    public class IdentityUserTests : BaseMongoDbRepositoryTests<IdentityUserTest>\n    {\n        [Fact]\n        public void AddOne()\n        {\n            // Arrange\n            var document = new IdentityUserTest();\n            // Act\n            SUT.AddOne<IdentityUserTest, Guid>(document);\n            // Assert\n            long count = SUT.Count<IdentityUserTest, Guid>(e => e.Id == document.Id);\n            Assert.Equal(1, count);\n        }\n\n        [Fact]\n        public async Task AddOneAsync()\n        {\n            // Arrange\n            var document = new IdentityUserTest();\n            // Act\n            await SUT.AddOneAsync<IdentityUserTest, Guid>(document);\n            // Assert\n            long count = SUT.Count<IdentityUserTest, Guid>(e => e.Id == document.Id);\n            Assert.Equal(1, count);\n        }\n\n        [Fact]\n        public void AddMany()\n        {\n            // Arrange\n            var documents = new List<IdentityUserTest> { new IdentityUserTest(), new IdentityUserTest() };\n            // Act\n            SUT.AddMany<IdentityUserTest, Guid>(documents);\n            // Assert\n            long count = SUT.Count<IdentityUserTest, Guid>(e => e.Id == documents[0].Id || e.Id == documents[1].Id);\n            Assert.Equal(2, count);\n        }\n\n        [Fact]\n        public async Task AddManyAsync()\n        {\n            // Arrange\n            var documents = new List<IdentityUserTest> { new IdentityUserTest(), new IdentityUserTest() };\n            // Act\n            await SUT.AddManyAsync<IdentityUserTest, Guid>(documents);\n            // Assert\n            long count = SUT.Count<IdentityUserTest, Guid>(e => e.Id == documents[0].Id || e.Id == documents[1].Id);\n            Assert.Equal(2, count);\n        }\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/Infrastructure/BaseMongoDbRepositoryTests.cs",
    "content": "﻿using MongoDbGenericRepository.Models;\nusing System.Collections.Generic;\nusing System;\n\nnamespace CoreIntegrationTests.Infrastructure\n{\n\n    public class BaseMongoDbRepositoryTests<T> : IDisposable where T : new() \n    {\n        public T CreateTestDocument()\n        {\n            return new T();\n        }\n\n        public List<T> CreateTestDocuments(int numberOfDocumentsToCreate)\n        {\n            var docs = new List<T>();\n            for(var i = 0; i < numberOfDocumentsToCreate; i++)\n            {\n                docs.Add(new T());\n            }\n            return docs;\n        }\n\n        /// <summary>\n        /// Constructor, init code\n        /// </summary>\n        public BaseMongoDbRepositoryTests()\n        {\n            Init();\n            var type = CreateTestDocument();\n            if (type is IPartitionedDocument)\n            {\n                PartitionKey = ((IPartitionedDocument)type).PartitionKey;\n            }\n        }\n\n        public string PartitionKey { get; set; }\n\n        /// <summary>\n        /// SUT: System Under Test\n        /// </summary>\n        protected static ITestRepository SUT { get; set; }\n\n        public void Init()\n        {\n            MongoDbConfig.EnsureConfigured();\n            SUT = TestRepository.Instance;\n        }\n\n        public void Cleanup()\n        {\n            // We drop the collection at the end of each test session.\n            if (!string.IsNullOrEmpty(PartitionKey))\n            {\n                SUT.DropTestCollection<T>(PartitionKey);\n            }\n            else\n            {\n                SUT.DropTestCollection<T>();\n            }\n        }\n\n        #region IDisposable Support\n        private bool _disposedValue; // Pour détecter les appels redondants\n\n        protected virtual void Dispose(bool disposing)\n        {\n            if (!_disposedValue)\n            {\n                if (disposing)\n                {\n                    Cleanup();\n                }\n\n                _disposedValue = true;\n            }\n        }\n\n        // Ce code est ajouté pour implémenter correctement le modèle supprimable.\n        public void Dispose()\n        {\n            // Ne modifiez pas ce code. Placez le code de nettoyage dans Dispose(bool disposing) ci-dessus.\n            Dispose(true);\n        }\n        #endregion\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/Infrastructure/GlobalVariables.cs",
    "content": "﻿using System;\n\nnamespace CoreIntegrationTests.Infrastructure\n{\n    /// <summary>\n    /// A class holding global variables.\n    /// </summary>\n    public static class GlobalVariables\n    {\n        /// <summary>\n        /// A random number generator.\n        /// </summary>\n        public static Random Random = new Random();\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/Infrastructure/ITestRepository.cs",
    "content": "﻿using MongoDbGenericRepository;\n\nnamespace CoreIntegrationTests\n{\n    public interface ITestRepository : IBaseMongoRepository\n    {\n        void DropTestCollection<TDocument>();\n        void DropTestCollection<TDocument>(string partitionKey);\n    }\n}"
  },
  {
    "path": "CoreIntegrationTests/Infrastructure/MongoDbConfig.cs",
    "content": "﻿using MongoDB.Bson.Serialization.Conventions;\nusing System.Threading;\n\nnamespace CoreIntegrationTests.Infrastructure\n{\n    internal static class MongoDbConfig\n    {\n        private static bool _initialized;\n        private static object _initializationLock = new();\n        private static object _initializationTarget;\n\n        public static void EnsureConfigured()\n        {\n            EnsureConfiguredImpl();\n        }\n\n        private static void EnsureConfiguredImpl()\n        {\n            LazyInitializer.EnsureInitialized(ref _initializationTarget, ref _initialized, ref _initializationLock, () =>\n            {\n                Configure();\n                return null;\n            });\n        }\n\n        private static void Configure()\n        {\n            RegisterConventions();\n        }\n\n        private static void RegisterConventions()\n        {\n            var pack = new ConventionPack\n            {\n                new IgnoreIfNullConvention(false),\n                new CamelCaseElementNameConvention(),\n            };\n        }\n\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/Infrastructure/MongoDbDocumentTestBase.Main.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.Models;\nusing Xunit;\n\nnamespace CoreIntegrationTests.Infrastructure\n{\n    public abstract partial class MongoDbDocumentTestBase<T> \n        where T : TestDoc, new()\n    {\n\n        private readonly MongoDbTestFixture<T, Guid> _fixture;\n\n        protected MongoDbDocumentTestBase(MongoDbTestFixture<T, Guid> fixture)\n        {\n            _fixture = fixture;\n            var type = CreateTestDocument();\n            DocumentTypeName = type.GetType().FullName;\n            if (type is IPartitionedDocument)\n            {\n                PartitionKey = ((IPartitionedDocument)type).PartitionKey;\n            }\n            _fixture.PartitionKey = PartitionKey;\n            TestClassName = GetClassName();\n            MongoDbConfig.EnsureConfigured();\n            SUT = TestTKeyRepository<Guid>.Instance;\n        }\n\n        protected T CreateTestDocument()\n        {\n            return _fixture.CreateTestDocument();\n        }\n\n        public abstract string GetClassName();\n\n        protected List<T> CreateTestDocuments(int numberOfDocumentsToCreate)\n        {\n            return _fixture.CreateTestDocuments(numberOfDocumentsToCreate);\n        }\n\n        /// <summary>\n        /// The partition key for the collection, if any\n        /// </summary>\n        protected string PartitionKey { get; set; }\n\n        /// <summary>\n        /// the name of the test class\n        /// </summary>\n        protected string TestClassName { get; set; }\n\n        /// <summary>\n        /// The name of the document used for tests\n        /// </summary>\n        protected string DocumentTypeName { get; set; }\n\n        /// <summary>\n        /// SUT: System Under Test\n        /// </summary>\n        protected static ITestRepository<Guid> SUT { get; set; }\n\n        #region Add\n\n        [Fact]\n        public void AddOne()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            // Act\n            SUT.AddOne(document);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T>(e => e.Id.Equals(document.Id))\n                                                            : SUT.Count<T>(e => e.Id.Equals(document.Id), PartitionKey);\n            Assert.True(1 == count, GetTestName());\n        }\n\n        [Fact]\n        public async Task AddOneAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            // Act\n            await SUT.AddOneAsync(document);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T>(e => e.Id.Equals(document.Id))\n                                                            : SUT.Count<T>(e => e.Id.Equals(document.Id), PartitionKey);\n            Assert.True(1 == count, GetTestName());\n        }\n\n        [Fact]\n        public void AddMany()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            // Act\n            SUT.AddMany(documents);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T>(e => e.Id.Equals(documents[0].Id)\n                                                                                   || e.Id.Equals(documents[1].Id))\n                                                            : SUT.Count<T>(e => e.Id.Equals(documents[0].Id)\n                                                                                  || e.Id.Equals(documents[1].Id), PartitionKey);\n            Assert.True(2 == count, GetTestName());\n        }\n\n        [Fact]\n        public void AddManyWithDifferentPartitionKey()\n        {\n            // only run this test for tests on documents with partition key\n            if (!string.IsNullOrEmpty(PartitionKey))\n            {\n                // Arrange\n                var documents = CreateTestDocuments(4);\n                if (documents.Any(e => e is IPartitionedDocument))\n                {\n                    var secondPartitionKey = $\"{PartitionKey}-2\";\n                    ((IPartitionedDocument)documents[2]).PartitionKey = secondPartitionKey;\n                    ((IPartitionedDocument)documents[3]).PartitionKey = secondPartitionKey;\n                    // Act\n                    SUT.AddMany(documents);\n                    // Assert\n                    long count = SUT.Count<T>(e => e.Id.Equals(documents[0].Id) || e.Id.Equals(documents[1].Id), PartitionKey);\n                    long secondPartitionCount = SUT.Count<T>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);\n                    // Cleanup second partition\n                    SUT.DeleteMany<T>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);\n                    Assert.True(2 == count, GetTestName());\n                    Assert.True(2 == secondPartitionCount, GetTestName());\n                }\n            }\n        }\n\n        [Fact]\n        public async Task AddManyAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            // Act\n            await SUT.AddManyAsync(documents);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T>(e => e.Id.Equals(documents[0].Id)\n                                                                                   || e.Id.Equals(documents[1].Id))\n                                                            : SUT.Count<T>(e => e.Id.Equals(documents[0].Id)\n                                                                                  || e.Id.Equals(documents[1].Id), PartitionKey);\n            Assert.True(2 == count, GetTestName());\n        }\n\n        [Fact]\n        public async Task AddManyAsyncWithDifferentPartitionKey()\n        {\n            // only run this test for tests on documents with partition key\n            if (!string.IsNullOrEmpty(PartitionKey))\n            {\n                // Arrange\n                var documents = CreateTestDocuments(4);\n                if (documents.Any(e => e is IPartitionedDocument))\n                {\n                    var secondPartitionKey = $\"{PartitionKey}-2\";\n                    ((IPartitionedDocument)documents[2]).PartitionKey = secondPartitionKey;\n                    ((IPartitionedDocument)documents[3]).PartitionKey = secondPartitionKey;\n                    // Act\n                    await SUT.AddManyAsync(documents);\n                    // Assert\n                    long count = SUT.Count<T>(e => e.Id.Equals(documents[0].Id) || e.Id.Equals(documents[1].Id), PartitionKey);\n                    long secondPartitionCount = SUT.Count<T>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);\n                    // Cleanup second partition\n                    SUT.DeleteMany<T>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);\n                    Assert.True(2 == count, GetTestName());\n                    Assert.True(2 == secondPartitionCount, GetTestName());\n                }\n            }\n        }\n\n        #endregion Add\n\n        #region Read\n\n        [Fact]\n        public async Task GetByIdAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync(document);\n            // Act\n            var result = await SUT.GetByIdAsync<T>(document.Id, PartitionKey);\n            // Assert\n            Assert.True(null != result, GetTestName());\n        }\n\n        [Fact]\n        public void GetById()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = SUT.GetById<T>(document.Id, PartitionKey);\n            // Assert\n            Assert.True(null != result, GetTestName());\n        }\n\n        [Fact]\n        public async Task GetOneAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = await SUT.GetOneAsync<T>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.True(null != result, GetTestName());\n        }\n\n        [Fact]\n        public void GetOne()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = SUT.GetOne<T>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.True(null != result, GetTestName());\n        }\n\n        [Fact]\n        public void GetCursor()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var cursor = SUT.GetCursor<T>(x => x.Id.Equals(document.Id), PartitionKey);\n            var count = cursor.CountDocuments();\n            // Assert\n            Assert.True(1 == count, GetTestName());\n        }\n\n        [Fact]\n        public async Task AnyAsyncReturnsTrue()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = await SUT.AnyAsync<T>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.True(result, GetTestName());\n        }\n\n        [Fact]\n        public async Task AnyAsyncReturnsFalse()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = await SUT.AnyAsync<T>(x => x.Id.Equals(Guid.NewGuid()), PartitionKey);\n            // Assert\n            Assert.False(result, GetTestName());\n        }\n\n        [Fact]\n        public void AnyReturnsTrue()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = SUT.Any<T>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.True(result, GetTestName());\n        }\n\n        [Fact]\n        public void AnyReturnsFalse()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = SUT.Any<T>(x => x.Id.Equals(Guid.NewGuid()), PartitionKey);\n            // Assert\n            Assert.False(result, GetTestName());\n        }\n\n        [Fact]\n        public async Task GetAllAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany(documents);\n            // Act\n            var result = await SUT.GetAllAsync<T>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.True(5 == result.Count, GetTestName());\n        }\n\n        [Fact]\n        public void GetAll()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany(documents);\n            // Act\n            var result = SUT.GetAll<T>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.True(5 == result.Count, GetTestName());\n        }\n\n        [Fact]\n        public async Task CountAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany(documents);\n            // Act\n            var result = await SUT.CountAsync<T>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.True(5 == result, GetTestName());\n        }\n\n        [Fact]\n        public void Count()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany(documents);\n            // Act\n            var result = SUT.Count<T>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.True(5 == result, GetTestName());\n        }\n\n        #endregion Read\n\n        #region Delete\n\n        [Fact]\n        public void DeleteOne()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = SUT.DeleteOne(document);\n            // Assert\n            Assert.True(1 == result);\n            Assert.False(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());\n        }\n\n        [Fact]\n        public void DeleteOneLinq()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = SUT.DeleteOne<T>(e => e.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.True(1 == result);\n            Assert.False(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());\n        }\n\n        [Fact]\n        public async Task DeleteOneAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = await SUT.DeleteOneAsync(document);\n            // Assert\n            Assert.True(1 == result);\n            Assert.False(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());\n        }\n\n        [Fact]\n        public async Task DeleteOneAsyncLinq()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = await SUT.DeleteOneAsync<T>(e => e.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.True(1 == result);\n            Assert.False(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());\n        }\n\n        [Fact]\n        public async Task DeleteManyAsyncLinq()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            SUT.AddMany(documents);\n            // Act\n            var result = await SUT.DeleteManyAsync<T>(e => e.SomeContent == criteria, PartitionKey);\n            // Assert\n            Assert.True(5 == result);\n            Assert.False(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), GetTestName());\n        }\n\n        [Fact]\n        public async Task DeleteManyAsync()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            var canPartition = !string.IsNullOrEmpty(PartitionKey) && documents.Any(e => e is IPartitionedDocument);\n            string secondKey = null;\n            if (canPartition)\n            {\n                secondKey = $\"{PartitionKey}-2\";\n                ((IPartitionedDocument)documents[3]).PartitionKey = secondKey;\n                ((IPartitionedDocument)documents[4]).PartitionKey = secondKey;\n            }\n\n            SUT.AddMany(documents);\n            // Act\n            var result = await SUT.DeleteManyAsync(documents);\n            // Assert\n            Assert.True(5 == result);\n            Assert.False(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), GetTestName());\n            if (canPartition)\n            {\n                Assert.False(SUT.Any<T>(e => e.SomeContent == criteria, secondKey), GetTestName());\n            }\n        }\n\n        [Fact]\n        public void DeleteManyLinq()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            SUT.AddMany(documents);\n            // Act\n            var result = SUT.DeleteMany<T>(e => e.SomeContent == criteria, PartitionKey);\n            // Assert\n            Assert.True(5 == result);\n            Assert.False(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), GetTestName());\n        }\n\n        [Fact]\n        public void DeleteMany()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            var canPartition = !string.IsNullOrEmpty(PartitionKey) && documents.Any(e => e is IPartitionedDocument);\n            string secondKey = null;\n            if (canPartition)\n            {\n                secondKey = $\"{PartitionKey}-2\";\n                ((IPartitionedDocument)documents[3]).PartitionKey = secondKey;\n                ((IPartitionedDocument)documents[4]).PartitionKey = secondKey;\n            }\n\n            SUT.AddMany(documents);\n            // Act\n            var result = SUT.DeleteMany(documents);\n            // Assert\n            Assert.True(5 == result);\n            Assert.False(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), GetTestName());\n            if (canPartition)\n            {\n                Assert.False(SUT.Any<T>(e => e.SomeContent == criteria, secondKey), GetTestName());\n            }\n        }\n\n        #endregion Delete\n\n        #region Project\n\n        [Fact]\n        public async Task ProjectOneAsync()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var document = CreateTestDocument();\n            document.SomeContent = someContent;\n            document.Nested.SomeDate = someDate;\n            SUT.AddOne(document);\n            // Act\n            var result = await SUT.ProjectOneAsync<T, MyTestProjection>(\n                x => x.Id.Equals(document.Id),\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.True(null != result, GetTestName());\n            Assert.True(someContent == result.SomeContent, GetTestName());\n            Assert.True(someDate.Minute == result.SomeDate.Minute, GetTestName());\n            Assert.True(someDate.Second == result.SomeDate.Second, GetTestName());\n        }\n\n        [Fact]\n        public void ProjectOne()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var document = CreateTestDocument();\n            document.SomeContent = someContent;\n            document.Nested.SomeDate = someDate;\n            SUT.AddOne(document);\n            // Act\n            var result = SUT.ProjectOne<T, MyTestProjection>(\n                x => x.Id.Equals(document.Id),\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.True(null != result, GetTestName());\n            Assert.True(someContent == result.SomeContent, GetTestName());\n            Assert.True(someDate.Minute == result.SomeDate.Minute, GetTestName());\n            Assert.True(someDate.Second == result.SomeDate.Second, GetTestName());\n        }\n\n        [Fact]\n        public async Task ProjectManyAsync()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e =>\n            {\n                e.SomeContent = someContent;\n                e.Nested.SomeDate = someDate;\n            });\n\n            SUT.AddMany(documents);\n            // Act\n            var result = await SUT.ProjectManyAsync<T, MyTestProjection>(\n                x => x.SomeContent == someContent,\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.True(5 == result.Count, GetTestName());\n            Assert.True(someContent == result.First().SomeContent, GetTestName());\n            Assert.True(someDate.Minute == result.First().SomeDate.Minute, GetTestName());\n            Assert.True(someDate.Second == result.First().SomeDate.Second, GetTestName());\n        }\n\n        [Fact]\n        public void ProjectMany()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e =>\n            {\n                e.SomeContent = someContent;\n                e.Nested.SomeDate = someDate;\n            });\n\n            SUT.AddMany(documents);\n            // Act\n            var result = SUT.ProjectMany<T, MyTestProjection>(\n                x => x.SomeContent == someContent,\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.True(5 == result.Count, GetTestName());\n            Assert.True(someContent == result.First().SomeContent, GetTestName());\n            Assert.True(someDate.Minute == result.First().SomeDate.Minute, GetTestName());\n            Assert.True(someDate.Second == result.First().SomeDate.Second, GetTestName());\n        }\n\n        #endregion Project\n\n        #region Max / Min Queries\n\n        [Fact]\n        public async Task GetByMaxAsync()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany(documents);\n            var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = await SUT.GetByMaxAsync<T>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.NotNull(result);\n            Assert.Equal(expectedMax.Id, result.Id);\n        }\n\n        [Fact]\n        public void GetByMax()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany(documents);\n            var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = SUT.GetByMax<T>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.NotNull(result);\n            Assert.Equal(expectedMax.Id, result.Id);\n        }\n\n        [Fact]\n        public async Task GetByMinAsync()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany(documents);\n            var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = await SUT.GetByMinAsync<T>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.NotNull(result);\n            Assert.Equal(expectedMin.Id, result.Id);\n        }\n\n        [Fact]\n        public void GetByMin()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany(documents);\n            var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = SUT.GetByMin<T>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.NotNull(result);\n            Assert.Equal(expectedMin.Id, result.Id);\n        }\n\n        [Fact]\n        public void GetMinValue()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany(documents);\n            var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = SUT.GetMinValue<T, DateTime>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.True(result != default(DateTime));\n            Assert.Equal(expectedMin.Nested.SomeDate.Date, result.Date);\n        }\n\n        [Fact]\n        public async Task GetMinValueAsync()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany(documents);\n            var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = await SUT.GetMinValueAsync<T, DateTime>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.True(result != default(DateTime));\n            Assert.Equal(expectedMin.Nested.SomeDate.Date, result.Date);\n        }\n\n        [Fact]\n        public void GetMaxValue()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany(documents);\n            var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = SUT.GetMaxValue<T, DateTime>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.True(result != default(DateTime));\n            Assert.Equal(expectedMax.Nested.SomeDate.Date, result.Date);\n        }\n\n        [Fact]\n        public async Task GetMaxValueAsync()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany(documents);\n            var expectedMin = documents.OrderByDescending(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = await SUT.GetMaxValueAsync<T, DateTime>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.True(result != default(DateTime));\n            Assert.Equal(expectedMin.Nested.SomeDate.Date, result.Date);\n        }\n\n        #endregion Max / Min Queries\n\n        #region Index Management\n\n        static SemaphoreSlim textIndexSemaphore = new SemaphoreSlim(1, 1);\n\n        [Fact]\n        public async Task CreateTextIndexNoOptionAsync()\n        {\n            // Arrange \n            const string expectedIndexName = \"SomeContent_text\";\n\n            // Act\n            await textIndexSemaphore.WaitAsync();\n            try\n            {\n                var result = await SUT.CreateTextIndexAsync<T>(x => x.SomeContent, null, PartitionKey);\n\n                // Assert\n                var listOfIndexNames = await SUT.GetIndexesNamesAsync<T>(PartitionKey);\n                Assert.Contains(expectedIndexName, listOfIndexNames);\n\n                // Cleanup \n                await SUT.DropIndexAsync<T>(expectedIndexName, PartitionKey);\n            }\n            finally\n            {\n                textIndexSemaphore.Release();\n            }\n        }\n\n        [Fact]\n        public async Task CreateTextIndexWithOptionAsync()\n        {\n            // Arrange\n            string expectedIndexName = $\"{Guid.NewGuid()}\";\n            var option = new IndexCreationOptions\n            {\n                Name = expectedIndexName\n            };\n            await textIndexSemaphore.WaitAsync();\n            try\n            {\n                // Act\n                var result = await SUT.CreateTextIndexAsync<T>(x => x.AddedAtUtc, option, PartitionKey);\n\n                // Assert\n                var listOfIndexNames = await SUT.GetIndexesNamesAsync<T>(PartitionKey);\n                Assert.Contains(expectedIndexName, listOfIndexNames);\n\n                // Cleanup\n                await SUT.DropIndexAsync<T>(expectedIndexName, PartitionKey);\n            }\n            finally\n            {\n                textIndexSemaphore.Release();\n            }\n        }\n\n        [Fact]\n        public async Task CreateAscendingIndexAsync()\n        {\n            // Arrange \n            const string expectedIndexName = \"SomeContent_1\";\n\n            // Act\n            var result = await SUT.CreateAscendingIndexAsync<T>(x => x.SomeContent, null, PartitionKey);\n\n            // Assert\n            var listOfIndexNames = await SUT.GetIndexesNamesAsync<T>(PartitionKey);\n            Assert.Contains(expectedIndexName, listOfIndexNames);\n\n            // Cleanup \n            await SUT.DropIndexAsync<T>(expectedIndexName, PartitionKey);\n        }\n\n        [Fact]\n        public async Task CreateDescendingIndexAsync()\n        {\n            // Arrange \n            const string expectedIndexName = \"SomeContent_-1\";\n\n            // Act\n            var result = await SUT.CreateDescendingIndexAsync<T>(x => x.SomeContent, null, PartitionKey);\n\n            // Assert\n            var listOfIndexNames = await SUT.GetIndexesNamesAsync<T>(PartitionKey);\n            Assert.Contains(expectedIndexName, listOfIndexNames);\n\n            // Cleanup \n            await SUT.DropIndexAsync<T>(expectedIndexName, PartitionKey);\n        }\n\n        [Fact]\n        public async Task CreateHashedIndexAsync()\n        {\n            // Arrange \n            const string expectedIndexName = \"SomeContent_hashed\";\n\n            // Act\n            var result = await SUT.CreateHashedIndexAsync<T>(x => x.SomeContent, null, PartitionKey);\n\n            // Assert\n            var listOfIndexNames = await SUT.GetIndexesNamesAsync<T>(PartitionKey);\n            Assert.Contains(expectedIndexName, listOfIndexNames);\n\n            // Cleanup \n            await SUT.DropIndexAsync<T>(expectedIndexName, PartitionKey);\n        }\n\n        [Fact]\n        public async Task CreateCombinedTextIndexAsync()\n        {\n            // Arrange \n            const string expectedIndexName = \"SomeContent2_text_SomeContent3_text\";\n\n            // Act\n            Expression <Func<T, object>> ex = x => x.SomeContent2;\n            Expression <Func<T, object>> ex2 = x => x.SomeContent3;\n            var result = await SUT.CreateCombinedTextIndexAsync(new[] { ex, ex2 }, null, PartitionKey);\n\n            // Assert\n            var listOfIndexNames = await SUT.GetIndexesNamesAsync<T>(PartitionKey);\n            Assert.Contains(expectedIndexName, listOfIndexNames);\n\n            // Cleanup \n            await SUT.DropIndexAsync<T>(expectedIndexName, PartitionKey);\n        }\n\n        #endregion Index Management\n\n        #region Math\n\n        [Fact]\n        public async Task SumByDecimalAsync()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.Nested.SomeAmount = 5m;\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany(documents);\n            var expectedSum = documents.Sum(e => e.Nested.SomeAmount);\n\n            // Act\n            var result = await SUT.SumByAsync<T>(e => e.SomeContent == criteria, e => e.Nested.SomeAmount, PartitionKey);\n\n            // Assert\n            Assert.Equal(expectedSum, result);\n        }\n\n        [Fact]\n        public void SumByDecimal()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.Nested.SomeAmount = 5m;\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany(documents);\n            var expectedSum = documents.Sum(e => e.Nested.SomeAmount);\n\n            // Act\n            var result = SUT.SumBy<T>(e => e.SomeContent == criteria, e => e.Nested.SomeAmount, PartitionKey);\n\n            // Assert\n            Assert.Equal(expectedSum, result);\n        }\n\n        #endregion Math\n\n        #region Test Utils\n\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        private string GetCurrentMethod()\n        {\n            StackTrace st = new StackTrace();\n            StackFrame sf = st.GetFrame(1);\n\n            return sf.GetMethod().Name;\n        }\n\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        private string GetParentMethod()\n        {\n            StackTrace st = new StackTrace();\n            StackFrame sf = st.GetFrame(2);\n            var method = sf.GetMethod().DeclaringType.Name;\n            return method;\n        }\n\n        private string GetTestName()\n        {\n            return $\"{TestClassName}{PartitionKey}.{GetParentMethod()}\";\n        }\n\n        private string GetContent()\n        {\n            return $\"{TestClassName}{PartitionKey}.{Guid.NewGuid()}.{GetParentMethod()}\";\n        }\n\n        private void Cleanup()\n        {\n            // We drop the collection at the end of each test session.\n            if (!string.IsNullOrEmpty(PartitionKey))\n            {\n                SUT.DropTestCollection<T>(PartitionKey);\n            }\n            else\n            {\n                SUT.DropTestCollection<T>();\n            }\n        }\n\n        #endregion Test Utils\n\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/Infrastructure/MongoDbDocumentTestBase.Update.cs",
    "content": "﻿using MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.Models;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace CoreIntegrationTests.Infrastructure\n{\n    public abstract partial class MongoDbDocumentTestBase<T> :\n        IClassFixture<MongoDbTestFixture<T, Guid>>\n        where T : TestDoc, new()\n    {\n        #region Update One\n\n        [Fact]\n        public void UpdateOne()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T>(document);\n            var content = GetContent();\n            document.SomeContent = content;\n            // Act\n            var result = SUT.UpdateOne<T>(document);\n            // Assert\n            Assert.True(result);\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument, GetTestName());\n            Assert.True(content == updatedDocument.SomeContent, GetTestName());\n        }\n\n        [Fact]\n        public async Task UpdateOneAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T>(document);\n            var content = GetContent();\n            document.SomeContent = content;\n            // Act\n            var result = await SUT.UpdateOneAsync<T>(document);\n            // Assert\n            Assert.True(result);\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument, GetTestName());\n            Assert.True(content == updatedDocument.SomeContent, GetTestName());\n        }\n\n        [Fact]\n        public void UpdateOneField()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T>(document);\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateOne<T, string>(document, x => x.SomeContent, content);\n            // Assert\n            Assert.True(result, GetTestName());\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument, GetTestName());\n            Assert.True(content == updatedDocument.SomeContent, GetTestName());\n        }\n\n        [Fact]\n        public async Task UpdateOneFieldAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T>(document);\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateOneAsync<T, string>(document, x => x.SomeContent, content);\n            // Assert\n            Assert.True(result, GetTestName());\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument, GetTestName());\n            Assert.True(content == updatedDocument.SomeContent, GetTestName());\n        }\n\n        [Fact]\n        public void UpdateOneFieldWithFilter()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T>(document);\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateOne<T, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.True(result, GetTestName());\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument, GetTestName());\n            Assert.True(content == updatedDocument.SomeContent, GetTestName());\n        }\n\n        [Fact]\n        public async Task UpdateOneFieldWithFilterAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T>(document);\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateOneAsync<T, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.True(result, GetTestName());\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument, GetTestName());\n            Assert.True(content == updatedDocument.SomeContent, GetTestName());\n        }\n\n        [Fact]\n        public async Task UpdateOneAsyncWithUpdateDefinition()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T>(document);\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = MongoDB.Driver.Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n\n            // Act\n            var result = await SUT.UpdateOneAsync<T>(document, updateDef);\n            // Assert\n            Assert.True(result);\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument);\n            Assert.True(childrenToAdd[0].Type == updatedDocument.Children[0].Type, GetTestName());\n            Assert.True(childrenToAdd[0].Value == updatedDocument.Children[0].Value, GetTestName());\n            Assert.True(childrenToAdd[1].Type == updatedDocument.Children[1].Type, GetTestName());\n            Assert.True(childrenToAdd[1].Value == updatedDocument.Children[1].Value, GetTestName());\n        }\n\n        [Fact]\n        public void UpdateOneWithUpdateDefinition()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T>(document);\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = MongoDB.Driver.Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n\n            // Act\n            var result = SUT.UpdateOne<T>(document, updateDef);\n            // Assert\n            Assert.True(result);\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument);\n            Assert.True(childrenToAdd[0].Type == updatedDocument.Children[0].Type, GetTestName());\n            Assert.True(childrenToAdd[0].Value == updatedDocument.Children[0].Value, GetTestName());\n            Assert.True(childrenToAdd[1].Type == updatedDocument.Children[1].Type, GetTestName());\n            Assert.True(childrenToAdd[1].Value == updatedDocument.Children[1].Value, GetTestName());\n        }\n\n        #endregion Update One\n\n        #region Update Many\n\n        [Fact]\n        public async Task UpdateManyWithLinqFilterAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T>(documents);\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateManyAsync<T, string>(x => docIds.Contains(x.Id), x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocument = SUT.GetAll<T>(x => docIds.Contains(x.Id), PartitionKey);\n\n            Assert.True(updatedDocument.Count == 2);\n            Assert.True(updatedDocument.All(u => u.SomeContent == content), GetTestName());\n        }\n\n        [Fact]\n        public async Task UpdateManyWithFilterDefinitionAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T>(documents);\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var filterDefinition = Builders<T>.Filter.Where(x => docIds.Contains(x.Id));\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateManyAsync<T, string>(filterDefinition, x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocument = SUT.GetAll<T>(x => docIds.Contains(x.Id), PartitionKey);\n\n            Assert.True(updatedDocument.Count == 2);\n            Assert.True(updatedDocument.All(u => u.SomeContent == content), GetTestName());\n        }\n\n        [Fact]\n        public async Task UpdateManyWithLinqFilterAndUpdateDefinitionAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T>(documents);\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateManyAsync<T>(x => docIds.Contains(x.Id), updateDef, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocuments = SUT.GetAll<T>(x => docIds.Contains(x.Id), PartitionKey);\n\n            Assert.True(updatedDocuments.Count == 2);\n            updatedDocuments.ForEach(updatedDocument =>\n            {\n                Assert.True(childrenToAdd[0].Type == updatedDocument.Children[0].Type, GetTestName());\n                Assert.True(childrenToAdd[0].Value == updatedDocument.Children[0].Value, GetTestName());\n                Assert.True(childrenToAdd[1].Type == updatedDocument.Children[1].Type, GetTestName());\n                Assert.True(childrenToAdd[1].Value == updatedDocument.Children[1].Value, GetTestName());\n            });\n        }\n\n        [Fact]\n        public async Task UpdateManyWithFilterAndUpdateDefinitionsAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T>(documents);\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var filterDefinition = Builders<T>.Filter.Where(x => docIds.Contains(x.Id));\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateManyAsync<T>(filterDefinition, updateDef, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocuments = SUT.GetAll<T>(x => docIds.Contains(x.Id), PartitionKey);\n\n            Assert.True(updatedDocuments.Count == 2);\n            updatedDocuments.ForEach(updatedDocument =>\n            {\n                Assert.True(childrenToAdd[0].Type == updatedDocument.Children[0].Type, GetTestName());\n                Assert.True(childrenToAdd[0].Value == updatedDocument.Children[0].Value, GetTestName());\n                Assert.True(childrenToAdd[1].Type == updatedDocument.Children[1].Type, GetTestName());\n                Assert.True(childrenToAdd[1].Value == updatedDocument.Children[1].Value, GetTestName());\n            });\n        }\n\n\n        [Fact]\n        public void UpdateManyWithLinqFilter()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T>(documents);\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateMany<T, string>(x => docIds.Contains(x.Id), x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocument = SUT.GetAll<T>(x => docIds.Contains(x.Id), PartitionKey);\n            Assert.True(updatedDocument.Count == 2);\n            Assert.True(updatedDocument.All(u => u.SomeContent == content), GetTestName());\n        }\n\n        [Fact]\n        public void UpdateManyWithFilterDefinition()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T>(documents);\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var filterDefinition = Builders<T>.Filter.Where(x => docIds.Contains(x.Id));\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateMany<T, string>(filterDefinition, x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocument = SUT.GetAll<T>(x => docIds.Contains(x.Id), PartitionKey);\n\n            Assert.True(updatedDocument.Count == 2);\n            Assert.True(updatedDocument.All(u => u.SomeContent == content), GetTestName());\n        }\n\n        [Fact]\n        public void UpdateManyWithLinqFilterAndUpdateDefinition()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T>(documents);\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateMany<T>(x => docIds.Contains(x.Id), updateDef, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocuments = SUT.GetAll<T>(x => docIds.Contains(x.Id), PartitionKey);\n\n            Assert.True(updatedDocuments.Count == 2);\n            updatedDocuments.ForEach(updatedDocument =>\n            {\n                Assert.True(childrenToAdd[0].Type == updatedDocument.Children[0].Type, GetTestName());\n                Assert.True(childrenToAdd[0].Value == updatedDocument.Children[0].Value, GetTestName());\n                Assert.True(childrenToAdd[1].Type == updatedDocument.Children[1].Type, GetTestName());\n                Assert.True(childrenToAdd[1].Value == updatedDocument.Children[1].Value, GetTestName());\n            });\n        }\n\n        [Fact]\n        public void UpdateManyWithFilterAndUpdateDefinitions()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T>(documents);\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var filterDefinition = Builders<T>.Filter.Where(x => docIds.Contains(x.Id));\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateMany<T>(filterDefinition, updateDef, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocuments = SUT.GetAll<T>(x => docIds.Contains(x.Id), PartitionKey);\n\n            Assert.True(updatedDocuments.Count == 2);\n            updatedDocuments.ForEach(updatedDocument =>\n            {\n                Assert.True(childrenToAdd[0].Type == updatedDocument.Children[0].Type, GetTestName());\n                Assert.True(childrenToAdd[0].Value == updatedDocument.Children[0].Value, GetTestName());\n                Assert.True(childrenToAdd[1].Type == updatedDocument.Children[1].Type, GetTestName());\n                Assert.True(childrenToAdd[1].Value == updatedDocument.Children[1].Value, GetTestName());\n            });\n        }\n\n\n        #endregion Update Many\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/Infrastructure/MongoDbTKeyDocumentTestBase.Main.cs",
    "content": "﻿using MongoDB.Driver;\nusing MongoDbGenericRepository.Models;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace CoreIntegrationTests.Infrastructure\n{\n    public abstract partial class MongoDbTKeyDocumentTestBase<T, TKey> :\n        IClassFixture<MongoDbTestFixture<T, TKey>>\n        where T : TestDoc<TKey>, new()\n        where TKey : IEquatable<TKey>\n\n    {\n        private readonly MongoDbTestFixture<T, TKey> _fixture;\n\n        protected MongoDbTKeyDocumentTestBase(MongoDbTestFixture<T, TKey> fixture)\n        {\n            _fixture = fixture;\n            var type = CreateTestDocument();\n            DocumentTypeName = type.GetType().FullName;\n            if (type is IPartitionedDocument)\n            {\n                PartitionKey = ((IPartitionedDocument)type).PartitionKey;\n            }\n            _fixture.PartitionKey = PartitionKey;\n            TestClassName = GetClassName();\n            MongoDbConfig.EnsureConfigured();\n            SUT = TestRepository.Instance;\n        }\n\n        public abstract string GetClassName();\n\n        public T CreateTestDocument()\n        {\n            return _fixture.CreateTestDocument();\n        }\n\n        public List<T> CreateTestDocuments(int numberOfDocumentsToCreate)\n        {\n            return _fixture.CreateTestDocuments(numberOfDocumentsToCreate);\n        }\n\n        /// <summary>\n        /// The partition key for the collection, if any\n        /// </summary>\n        protected string PartitionKey { get; set; }\n\n        /// <summary>\n        /// the name of the test class\n        /// </summary>\n        protected string TestClassName { get; set; }\n\n        /// <summary>\n        /// The name of the document used for tests\n        /// </summary>\n        protected string DocumentTypeName { get; set; }\n\n        /// <summary>\n        /// SUT: System Under Test\n        /// </summary>\n        protected static ITestRepository SUT { get; set; }\n\n        #region Add\n\n        [Fact]\n        public void AddOne()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            // Act\n            SUT.AddOne<T, TKey>(document);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T, TKey>(e => e.Id.Equals(document.Id))\n                                                            : SUT.Count<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);\n            Assert.True(1 == count, GetTestName());\n        }\n\n        [Fact]\n        public async Task AddOneAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            // Act\n            await SUT.AddOneAsync<T, TKey>(document);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T, TKey>(e => e.Id.Equals(document.Id))\n                                                            : SUT.Count<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);\n            Assert.True(1 == count, GetTestName());\n        }\n\n        [Fact]\n        public void AddMany()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            // Act\n            SUT.AddMany<T, TKey>(documents);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T, TKey>(e => e.Id.Equals(documents[0].Id)\n                                                                                   || e.Id.Equals(documents[1].Id))\n                                                            : SUT.Count<T, TKey>(e => e.Id.Equals(documents[0].Id)\n                                                                                  || e.Id.Equals(documents[1].Id), PartitionKey);\n            Assert.True(2 == count, GetTestName());\n        }\n\n        [Fact]\n        public void AddManyWithDifferentPartitionKey()\n        {\n            // only run this test for tests on documents with partition key\n            if (!string.IsNullOrEmpty(PartitionKey))\n            {\n                // Arrange\n                var documents = CreateTestDocuments(4);\n                if (documents.Any(e => e is IPartitionedDocument))\n                {\n                    var secondPartitionKey = $\"{PartitionKey}-2\";\n                    ((IPartitionedDocument)documents[2]).PartitionKey = secondPartitionKey;\n                    ((IPartitionedDocument)documents[3]).PartitionKey = secondPartitionKey;\n                    // Act\n                    SUT.AddMany<T, TKey>(documents);\n                    // Assert\n                    long count = SUT.Count<T, TKey>(e => e.Id.Equals(documents[0].Id) || e.Id.Equals(documents[1].Id), PartitionKey);\n                    long secondPartitionCount = SUT.Count<T, TKey>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);\n                    // Cleanup second partition\n                    SUT.DeleteMany<T, TKey>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);\n                    Assert.True(2 == count, GetTestName());\n                    Assert.True(2 == secondPartitionCount, GetTestName());\n                }\n            }\n        }\n\n        [Fact]\n        public async Task AddManyAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            // Act\n            await SUT.AddManyAsync<T, TKey>(documents);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T, TKey>(e => e.Id.Equals(documents[0].Id)\n                                                                                   || e.Id.Equals(documents[1].Id))\n                                                            : SUT.Count<T, TKey>(e => e.Id.Equals(documents[0].Id)\n                                                                                  || e.Id.Equals(documents[1].Id), PartitionKey);\n            Assert.True(2 == count, GetTestName());\n        }\n\n        [Fact]\n        public async Task AddManyAsyncWithDifferentPartitionKey()\n        {\n            // only run this test for tests on documents with partition key\n            if (!string.IsNullOrEmpty(PartitionKey))\n            {\n                // Arrange\n                var documents = CreateTestDocuments(4);\n                if (documents.Any(e => e is IPartitionedDocument))\n                {\n                    var secondPartitionKey = $\"{PartitionKey}-2\";\n                    ((IPartitionedDocument)documents[2]).PartitionKey = secondPartitionKey;\n                    ((IPartitionedDocument)documents[3]).PartitionKey = secondPartitionKey;\n                    // Act\n                    await SUT.AddManyAsync<T, TKey>(documents);\n                    // Assert\n                    long count = SUT.Count<T, TKey>(e => e.Id.Equals(documents[0].Id) || e.Id.Equals(documents[1].Id), PartitionKey);\n                    long secondPartitionCount = SUT.Count<T, TKey>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);\n                    // Cleanup second partition\n                    SUT.DeleteMany<T, TKey>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);\n                    Assert.True(2 == count, GetTestName());\n                    Assert.True(2 == secondPartitionCount, GetTestName());\n                }\n            }\n        }\n\n        #endregion Add\n\n        #region Read\n\n        [Fact]\n        public async Task GetByIdAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = await SUT.GetByIdAsync<T, TKey>(document.Id, PartitionKey);\n            // Assert\n            Assert.True(null != result, GetTestName());\n        }\n\n        [Fact]\n        public void GetById()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            // Assert\n            Assert.True(null != result, GetTestName());\n        }\n        \n        [Fact]\n        public async Task GetOneByFilterDefinitionAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = await SUT.GetOneAsync<T, TKey>(Builders<T>.Filter.Eq(x => x.Id, document.Id), null, PartitionKey);\n            // Assert\n            Assert.True(null != result, GetTestName());\n        }\n        \n        [Fact]\n        public void GetOneByFilterDefinition()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.GetOne<T, TKey>(Builders<T>.Filter.Eq(x => x.Id, document.Id), null, PartitionKey);\n            // Assert\n            Assert.True(null != result, GetTestName());\n        }\n\n        [Fact]\n        public async Task GetOneAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = await SUT.GetOneAsync<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.True(null != result, GetTestName());\n        }\n\n        [Fact]\n        public void GetOne()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.GetOne<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.True(null != result, GetTestName());\n        }\n\n        [Fact]\n        public void GetCursor()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var cursor = SUT.GetCursor<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);\n            var count = cursor.CountDocuments();\n            // Assert\n            Assert.True(1 == count, GetTestName());\n        }\n        \n        [Fact]\n        public async Task AnyAsyncByDefinitionReturnsTrue()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = await SUT.AnyAsync<T, TKey>(Builders<T>.Filter.Eq(x => x.Id, document.Id), null, PartitionKey);\n            // Assert\n            Assert.True(result, GetTestName());\n        }\n\n        [Fact]\n        public async Task AnyAsyncByDefinitionReturnsFalse()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = await SUT.AnyAsync<T, TKey>(Builders<T>.Filter.Eq(x => x.Id, document.Init<TKey>()), null, PartitionKey);\n            // Assert\n            Assert.False(result, GetTestName());\n        }\n\n        [Fact]\n        public async Task AnyAsyncReturnsTrue()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = await SUT.AnyAsync<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.True(result, GetTestName());\n        }\n\n        [Fact]\n        public async Task AnyAsyncReturnsFalse()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = await SUT.AnyAsync<T, TKey>(x => x.Id.Equals(document.Init<TKey>()), PartitionKey);\n            // Assert\n            Assert.False(result, GetTestName());\n        }\n        \n        [Fact]\n        public void AnyByDefinitionReturnsTrue()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.Any<T, TKey>(Builders<T>.Filter.Eq(x => x.Id, document.Id), null, PartitionKey);\n            // Assert\n            Assert.True(result, GetTestName());\n        }\n\n        [Fact]\n        public void AnyByDefinitionReturnsFalse()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.Any<T, TKey>(Builders<T>.Filter.Eq(x => x.Id, document.Init<TKey>()), null, PartitionKey);\n            // Assert\n            Assert.False(result, GetTestName());\n        }\n\n        [Fact]\n        public void AnyReturnsTrue()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.Any<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.True(result, GetTestName());\n        }\n\n        [Fact]\n        public void AnyReturnsFalse()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.Any<T, TKey>(x => x.Id.Equals(document.Init<TKey>()), PartitionKey);\n            // Assert\n            Assert.False(result, GetTestName());\n        }\n        \n        [Fact]\n        public async Task GetAllByDefinitionAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = await SUT.GetAllAsync<T, TKey>(Builders<T>.Filter.Eq(x => x.SomeContent, content), null, PartitionKey);\n            // Assert\n            Assert.True(5 == result.Count, GetTestName());\n        }\n\n        [Fact]\n        public void GetAllByDefinition()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = SUT.GetAll<T, TKey>(Builders<T>.Filter.Eq(x => x.SomeContent, content), null, PartitionKey);\n            // Assert\n            Assert.True(5 == result.Count, GetTestName());\n        }\n\n        [Fact]\n        public async Task GetAllAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = await SUT.GetAllAsync<T, TKey>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.True(5 == result.Count, GetTestName());\n        }\n\n        [Fact]\n        public void GetAll()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = SUT.GetAll<T, TKey>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.True(5 == result.Count, GetTestName());\n        }\n        \n        [Fact]\n        public async Task CountByDefinitionAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = await SUT.CountAsync<T, TKey>(Builders<T>.Filter.Eq(x => x.SomeContent, content), null, PartitionKey);\n            // Assert\n            Assert.True(5 == result, GetTestName());\n        }\n\n        [Fact]\n        public void CountByDefinition()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = SUT.Count<T, TKey>(Builders<T>.Filter.Eq(x => x.SomeContent, content), null, PartitionKey);\n            // Assert\n            Assert.True(5 == result, GetTestName());\n        }\n\n        [Fact]\n        public async Task CountAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = await SUT.CountAsync<T, TKey>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.True(5 == result, GetTestName());\n        }\n\n        [Fact]\n        public void Count()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = SUT.Count<T, TKey>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.True(5 == result, GetTestName());\n        }\n\n        #endregion Read\n\n        #region Delete\n\n        [Fact]\n        public void DeleteOne()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.DeleteOne<T, TKey>(document);\n            // Assert\n            Assert.True(1 == result);\n            Assert.False(SUT.Any<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());\n        }\n\n        [Fact]\n        public void DeleteOneLinq()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.DeleteOne<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.True(1 == result);\n            Assert.False(SUT.Any<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());\n        }\n\n        [Fact]\n        public async Task DeleteOneAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = await SUT.DeleteOneAsync<T, TKey>(document);\n            // Assert\n            Assert.True(1 == result);\n            Assert.False(SUT.Any<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());\n        }\n\n        [Fact]\n        public async Task DeleteOneAsyncLinq()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = await SUT.DeleteOneAsync<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.True(1 == result);\n            Assert.False(SUT.Any<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());\n        }\n\n        [Fact]\n        public async Task DeleteManyAsyncLinq()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = await SUT.DeleteManyAsync<T, TKey>(e => e.SomeContent == criteria, PartitionKey);\n            // Assert\n            Assert.True(5 == result);\n            Assert.False(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), GetTestName());\n        }\n\n        [Fact]\n        public async Task DeleteManyAsync()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            var canPartition = !string.IsNullOrEmpty(PartitionKey) && documents.Any(e => e is IPartitionedDocument);\n            string secondKey = null;\n            if (canPartition)\n            {\n                secondKey = $\"{PartitionKey}-2\";\n                ((IPartitionedDocument)documents[3]).PartitionKey = secondKey;\n                ((IPartitionedDocument)documents[4]).PartitionKey = secondKey;\n            }\n\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = await SUT.DeleteManyAsync<T, TKey>(documents);\n            // Assert\n            Assert.True(5 == result);\n            Assert.False(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), GetTestName());\n            if (canPartition)\n            {\n                Assert.False(SUT.Any<T, TKey>(e => e.SomeContent == criteria, secondKey), GetTestName());\n            }\n        }\n\n        [Fact]\n        public void DeleteManyLinq()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = SUT.DeleteMany<T, TKey>(e => e.SomeContent == criteria, PartitionKey);\n            // Assert\n            Assert.True(5 == result);\n            Assert.False(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), GetTestName());\n        }\n\n        [Fact]\n        public void DeleteMany()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            var canPartition = !string.IsNullOrEmpty(PartitionKey) && documents.Any(e => e is IPartitionedDocument);\n            string secondKey = null;\n            if (canPartition)\n            {\n                secondKey = $\"{PartitionKey}-2\";\n                ((IPartitionedDocument)documents[3]).PartitionKey = secondKey;\n                ((IPartitionedDocument)documents[4]).PartitionKey = secondKey;\n            }\n\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = SUT.DeleteMany<T, TKey>(documents);\n            // Assert\n            Assert.True(5 == result);\n            Assert.False(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), GetTestName());\n            if (canPartition)\n            {\n                Assert.False(SUT.Any<T, TKey>(e => e.SomeContent == criteria, secondKey), GetTestName());\n            }\n        }\n\n        #endregion Delete\n\n        #region Project\n\n        [Fact]\n        public async Task ProjectOneAsync()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var document = CreateTestDocument();\n            document.SomeContent = someContent;\n            document.Nested.SomeDate = someDate;\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = await SUT.ProjectOneAsync<T, MyTestProjection, TKey>(\n                x => x.Id.Equals(document.Id),\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.True(null != result, GetTestName());\n            Assert.True(someContent == result.SomeContent, GetTestName());\n            Assert.True(someDate.Minute == result.SomeDate.Minute, GetTestName());\n            Assert.True(someDate.Second == result.SomeDate.Second, GetTestName());\n        }\n\n        [Fact]\n        public void ProjectOne()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var document = CreateTestDocument();\n            document.SomeContent = someContent;\n            document.Nested.SomeDate = someDate;\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.ProjectOne<T, MyTestProjection, TKey>(\n                x => x.Id.Equals(document.Id),\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.True(null != result, GetTestName());\n            Assert.True(someContent == result.SomeContent, GetTestName());\n            Assert.True(someDate.Minute == result.SomeDate.Minute, GetTestName());\n            Assert.True(someDate.Second == result.SomeDate.Second, GetTestName());\n        }\n\n        [Fact]\n        public async Task ProjectManyAsync()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e =>\n            {\n                e.SomeContent = someContent;\n                e.Nested.SomeDate = someDate;\n            });\n\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = await SUT.ProjectManyAsync<T, MyTestProjection, TKey>(\n                x => x.SomeContent == someContent,\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.True(5 == result.Count, GetTestName());\n            Assert.True(someContent == result.First().SomeContent, GetTestName());\n            Assert.True(someDate.Minute == result.First().SomeDate.Minute, GetTestName());\n            Assert.True(someDate.Second == result.First().SomeDate.Second, GetTestName());\n        }\n\n        [Fact]\n        public void ProjectMany()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e =>\n            {\n                e.SomeContent = someContent;\n                e.Nested.SomeDate = someDate;\n            });\n\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = SUT.ProjectMany<T, MyTestProjection, TKey>(\n                x => x.SomeContent == someContent,\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.True(5 == result.Count, GetTestName());\n            Assert.True(someContent == result.First().SomeContent, GetTestName());\n            Assert.True(someDate.Minute == result.First().SomeDate.Minute, GetTestName());\n            Assert.True(someDate.Second == result.First().SomeDate.Second, GetTestName());\n        }\n\n        #endregion Project\n\n        #region Max / Min Queries\n\n        [Fact]\n        public async Task GetByMaxAsync()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany<T, TKey>(documents);\n            var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = await SUT.GetByMaxAsync<T, TKey>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.NotNull(result);\n            Assert.Equal(expectedMax.Id, result.Id);\n        }\n\n        [Fact]\n        public void GetByMax()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany<T, TKey>(documents);\n            var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = SUT.GetByMax<T, TKey>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.NotNull(result);\n            Assert.Equal(expectedMax.Id, result.Id);\n        }\n\n        [Fact]\n        public void GetMaxValue()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany<T, TKey>(documents);\n            var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = SUT.GetMaxValue<T, TKey, DateTime>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.False(result == default(DateTime));\n            Assert.Equal(expectedMax.Nested.SomeDate.Date, result.Date);\n        }\n\n        [Fact]\n        public async Task GetMaxValueAsync()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany<T, TKey>(documents);\n            var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = await SUT.GetMaxValueAsync<T, TKey, DateTime>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.False(result == default(DateTime));\n            Assert.Equal(expectedMax.Nested.SomeDate.Date, result.Date);\n        }\n\n        [Fact]\n        public async Task GetByMinAsync()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany<T, TKey>(documents);\n            var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = await SUT.GetByMinAsync<T, TKey>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.NotNull(result);\n            Assert.Equal(expectedMin.Id, result.Id);\n        }\n\n        [Fact]\n        public void GetByMin()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany<T, TKey>(documents);\n            var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = SUT.GetByMin<T, TKey>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.NotNull(result);\n            Assert.Equal(expectedMin.Id, result.Id);\n        }\n\n        [Fact]\n        public void GetMinValue()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany<T, TKey>(documents);\n            var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = SUT.GetMinValue<T, TKey, DateTime>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.True(result != default(DateTime));\n            Assert.Equal(expectedMin.Nested.SomeDate.Date, result.Date);\n        }\n\n        [Fact]\n        public async Task GetMinValueAsync()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany<T, TKey>(documents);\n            var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();\n\n            // Act\n            var result = await SUT.GetMinValueAsync<T, TKey, DateTime>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);\n\n            // Assert\n            Assert.True(result != default(DateTime));\n            Assert.Equal(expectedMin.Nested.SomeDate.Date, result.Date);\n        }\n\n        #endregion Max / Min Queries\n\n        #region Index Management\n\n        static readonly SemaphoreSlim textIndexSemaphore = new SemaphoreSlim(1, 1);\n\n        [Fact]\n        public async Task CreateTextIndexNoOptionAsync()\n        {\n            // Arrange \n            const string expectedIndexName = \"SomeContent_text\";\n\n            // Act\n            await textIndexSemaphore.WaitAsync();\n            try\n            {\n                var result = await SUT.CreateTextIndexAsync<T, TKey>(x => x.SomeContent, null, PartitionKey);\n\n                // Assert\n                var listOfIndexNames = await SUT.GetIndexesNamesAsync<T, TKey>(PartitionKey);\n                Assert.Contains(expectedIndexName, listOfIndexNames);\n\n                // Cleanup \n                await SUT.DropIndexAsync<T, TKey>(expectedIndexName, PartitionKey);\n            }\n            finally\n            {\n                textIndexSemaphore.Release();\n            }\n        }\n\n        [Fact]\n        public async Task CreateTextIndexWithOptionAsync()\n        {\n            // Arrange\n            string expectedIndexName = $\"{Guid.NewGuid()}\";\n            var option = new IndexCreationOptions\n            {\n                Name = expectedIndexName\n            };\n            await textIndexSemaphore.WaitAsync();\n            try\n            {\n                // Act\n                var result = await SUT.CreateTextIndexAsync<T, TKey>(x => x.Version, option, PartitionKey);\n\n                // Assert\n                var listOfIndexNames = await SUT.GetIndexesNamesAsync<T, TKey>(PartitionKey);\n                Assert.Contains(expectedIndexName, listOfIndexNames);\n\n                // Cleanup\n                await SUT.DropIndexAsync<T, TKey>(expectedIndexName, PartitionKey);\n            }\n            finally\n            {\n                textIndexSemaphore.Release();\n            }\n        }\n\n        [Fact]\n        public async Task CreateAscendingIndexAsync()\n        {\n            // Arrange \n            const string expectedIndexName = \"SomeContent_1\";\n\n            // Act\n            var result = await SUT.CreateAscendingIndexAsync<T, TKey>(x => x.SomeContent, null, PartitionKey);\n\n            // Assert\n            var listOfIndexNames = await SUT.GetIndexesNamesAsync<T, TKey>(PartitionKey);\n            Assert.Contains(expectedIndexName, listOfIndexNames);\n\n            // Cleanup \n            await SUT.DropIndexAsync<T, TKey>(expectedIndexName, PartitionKey);\n        }\n\n        [Fact]\n        public async Task CreateDescendingIndexAsync()\n        {\n            // Arrange \n            const string expectedIndexName = \"SomeContent_-1\";\n\n            // Act\n            var result = await SUT.CreateDescendingIndexAsync<T, TKey>(x => x.SomeContent, null, PartitionKey);\n\n            // Assert\n            var listOfIndexNames = await SUT.GetIndexesNamesAsync<T, TKey>(PartitionKey);\n            Assert.Contains(expectedIndexName, listOfIndexNames);\n\n            // Cleanup \n            await SUT.DropIndexAsync<T, TKey>(expectedIndexName, PartitionKey);\n        }\n\n        [Fact]\n        public async Task CreateHashedIndexAsync()\n        {\n            // Arrange \n            const string expectedIndexName = \"SomeContent_hashed\";\n\n            // Act\n            var result = await SUT.CreateHashedIndexAsync<T, TKey>(x => x.SomeContent, null, PartitionKey);\n\n            // Assert\n            var listOfIndexNames = await SUT.GetIndexesNamesAsync<T, TKey>(PartitionKey);\n            Assert.Contains(expectedIndexName, listOfIndexNames);\n\n            // Cleanup \n            await SUT.DropIndexAsync<T, TKey>(expectedIndexName, PartitionKey);\n        }\n\n        [Fact]\n        public async Task CreateCombinedTextIndexAsync()\n        {\n            // Arrange \n            const string expectedIndexName = \"SomeContent4_text_SomeContent5_text\";\n\n            // Act\n            Expression<Func<T, object>> ex = x => x.SomeContent4;\n            Expression<Func<T, object>> ex2 = x => x.SomeContent5;\n\n            var result = await SUT.CreateCombinedTextIndexAsync<T, TKey>(new[] { ex, ex2 }, null, PartitionKey);\n\n            // Assert\n            var listOfIndexNames = await SUT.GetIndexesNamesAsync<T, TKey>(PartitionKey);\n            Assert.Contains(expectedIndexName, listOfIndexNames);\n\n            // Cleanup \n            await SUT.DropIndexAsync<T, TKey>(expectedIndexName, PartitionKey);\n        }\n\n        #endregion Index Management\n\n        #region Math\n\n        [Fact]\n        public async Task SumByDecimalAsync()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.Nested.SomeAmount = 5m;\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany<T, TKey>(documents);\n            var expectedSum = documents.Sum(e => e.Nested.SomeAmount);\n\n            // Act\n            var result = await SUT.SumByAsync<T, TKey>(e => e.SomeContent == criteria, e => e.Nested.SomeAmount, PartitionKey);\n\n            // Assert\n            Assert.Equal(expectedSum, result);\n        }\n\n        [Fact]\n        public void SumByDecimal()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(5);\n            var i = 1;\n            documents.ForEach(e =>\n            {\n                e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);\n                e.Nested.SomeAmount = 5m;\n                e.SomeContent = criteria;\n            });\n            SUT.AddMany<T, TKey>(documents);\n            var expectedSum = documents.Sum(e => e.Nested.SomeAmount);\n\n            // Act\n            var result = SUT.SumBy<T, TKey>(e => e.SomeContent == criteria, e => e.Nested.SomeAmount, PartitionKey);\n\n            // Assert\n            Assert.Equal(expectedSum, result);\n        }\n\n        #endregion Math\n\n        #region Group By\n\n        [Fact]\n        public void GroupByTProjection()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            for (var i = 0; i < documents.Count - 2; i++)\n            {\n                documents[i].GroupingKey = 1;\n                documents[i].SomeContent = $\"{content}-{i}\";\n            }\n            for (var i = 3; i < documents.Count; i++)\n            {\n                documents[i].GroupingKey = 2;\n                documents[i].SomeContent = $\"{content}-{i}\";\n            }\n            SUT.AddMany<T, TKey>(documents);\n\n            // Act\n            var result = SUT.GroupBy<T, int, ProjectedGroup, TKey>(\n                            e => e.GroupingKey, \n                            g => new ProjectedGroup\n                            {\n                                Key = g.Key,\n                                Content = g.Select(doc => doc.SomeContent).ToList()\n                            },\n                            PartitionKey);\n\n            // Assert\n            var key1Group = result.First(e => e.Key == 1);\n            Assert.NotNull(key1Group);\n            Assert.Equal(3, key1Group.Content.Count);\n            var key2Group = result.First(e => e.Key == 2);\n            Assert.NotNull(key2Group);\n            Assert.Equal(2, key2Group.Content.Count);\n        }\n\n        [Fact]\n        public void FilteredGroupByTProjection()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            for (var i = 0; i < documents.Count - 2; i++)\n            {\n                documents[i].GroupingKey = 4;\n                documents[i].SomeContent = $\"{content}-{i}\";\n            }\n            for (var i = 3; i < documents.Count; i++)\n            {\n                documents[i].GroupingKey = 5;\n                documents[i].SomeContent = $\"{content}-{i}\";\n            }\n            var guid1 = Guid.NewGuid().ToString(\"n\");\n            var guid2 = Guid.NewGuid().ToString(\"n\");\n            for (var i = 0; i < documents.Count - 1; i++)\n            {\n                documents[i].Children = new List<Child> {\n                    new Child(guid1, guid2)\n                };\n            }\n\n            SUT.AddMany<T, TKey>(documents);\n\n            // Act\n            var result = SUT.GroupBy<T, int, ProjectedGroup, TKey>(\n                            e => e.Children.Any(c => c.Type == guid1),\n                            e => e.GroupingKey, \n                            g => new ProjectedGroup\n                            {\n                                Key = g.Key,\n                                Content = g.Select(doc => doc.SomeContent).ToList()\n                            }, \n                            PartitionKey);\n\n            // Assert\n            var key1Group = result.First(e => e.Key == 4);\n            Assert.NotNull(key1Group);\n            Assert.Equal(3, key1Group.Content.Count);\n            var key2Group = result.First(e => e.Key == 5);\n            Assert.NotNull(key2Group);\n            Assert.Single(key2Group.Content);\n        }\n\n        #endregion Group By\n\n        #region Pagination\n\n        public static Random Random = new Random();\n\n        [Fact]\n        public async Task GetSortedPaginatedAsync()\n        {\n            // Arrange\n            var content = $\"{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(10);\n            for (var i = 0; i < 5; i++)\n            {\n                documents[i].GroupingKey = 8;\n                documents[i].Nested.SomeAmount = Random.Next(1, 500000);\n                documents[i].SomeContent = content;\n            }\n            for (var i = 5; i < documents.Count; i++)\n            {\n                documents[i].GroupingKey = 9;\n                documents[i].SomeContent = content;\n            }\n            SUT.AddMany<T, TKey>(documents);\n\n            documents = documents.OrderByDescending(e => e.Nested.SomeAmount).ToList();\n            var notExpected = documents.First();\n            var expectedFirstResult = documents[1];\n\n            // Act\n            var result = await SUT.GetSortedPaginatedAsync<T, TKey>(\n                            e => e.GroupingKey == 8 && e.SomeContent == content,\n                            e => e.Nested.SomeAmount,\n                            false,\n                            1,5,\n                            PartitionKey);\n\n            // Assert\n            Assert.Equal(4, result.Count);\n            Assert.True(!result.Contains(notExpected));\n            Assert.Equal(expectedFirstResult.Id, result[0].Id);\n        }\n\n        [Fact]\n        public async Task GetSortedPaginatedAsyncWithSortOptions()\n        {\n            // Arrange\n            var content = $\"{Guid.NewGuid()}\";\n            var documents = CreateTestDocuments(10);\n            for (var i = 0; i < 5; i++)\n            {\n                documents[i].GroupingKey = 8;\n                documents[i].Nested.SomeAmount = Random.Next(1, 500000);\n                documents[i].SomeContent = content;\n            }\n            for (var i = 5; i < documents.Count; i++)\n            {\n                documents[i].GroupingKey = 9;\n                documents[i].SomeContent = content;\n            }\n            SUT.AddMany<T, TKey>(documents);\n\n            documents = documents.OrderByDescending(e => e.Nested.SomeAmount).ToList();\n            var notExpected = documents.First();\n            var expectedFirstResult = documents[1];\n            var sorting = Builders<T>.Sort.Descending(e => e.Nested.SomeAmount);\n\n            // Act\n            var result = await SUT.GetSortedPaginatedAsync<T, TKey>(\n                            e => e.GroupingKey == 8 && e.SomeContent == content,\n                            sorting,\n                            1, 5,\n                            PartitionKey);\n\n            // Assert\n            Assert.Equal(4, result.Count);\n            Assert.True(!result.Contains(notExpected));\n            Assert.Equal(expectedFirstResult.Id, result[0].Id);\n        }\n\n        #endregion Pagination\n\n        #region Test Utils\n\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        private string GetCurrentMethod()\n        {\n            StackTrace st = new StackTrace();\n            StackFrame sf = st.GetFrame(1);\n\n            return sf.GetMethod().Name;\n        }\n\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        private string GetParentMethod()\n        {\n            StackTrace st = new StackTrace();\n            StackFrame sf = st.GetFrame(2);\n            var method = sf.GetMethod().DeclaringType.Name;\n            return method;\n        }\n\n        private string GetTestName()\n        {\n            return $\"{TestClassName}{PartitionKey}.{GetParentMethod()}\";\n        }\n\n        private string GetContent()\n        {\n            return $\"{TestClassName}{PartitionKey}.{Guid.NewGuid()}.{GetParentMethod()}\";\n        }\n\n        private void Cleanup()\n        {\n            // We drop the collection at the end of each test session.\n            if (!string.IsNullOrEmpty(PartitionKey))\n            {\n                SUT.DropTestCollection<T>(PartitionKey);\n            }\n            else\n            {\n                SUT.DropTestCollection<T>();\n            }\n        }\n\n        #endregion Test Utils\n\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/Infrastructure/MongoDbTKeyDocumentTestBase.Update.cs",
    "content": "﻿using MongoDB.Driver;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Xunit;\n\nnamespace CoreIntegrationTests.Infrastructure\n{\n    public abstract partial class MongoDbTKeyDocumentTestBase<T, TKey> :\n        IClassFixture<MongoDbTestFixture<T, TKey>>\n        where T : TestDoc<TKey>, new()\n        where TKey : IEquatable<TKey>\n\n    {\n        #region Update One\n\n        [Fact]\n        public void UpdateOne()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            var content = GetContent();\n            document.SomeContent = content;\n            // Act\n            var result = SUT.UpdateOne<T, TKey>(document);\n            // Assert\n            Assert.True(result);\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument, GetTestName());\n            Assert.True(content == updatedDocument.SomeContent, GetTestName());\n        }\n\n        [Fact]\n        public async Task UpdateOneAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            var content = GetContent();\n            document.SomeContent = content;\n            // Act\n            var result = await SUT.UpdateOneAsync<T, TKey>(document);\n            // Assert\n            Assert.True(result);\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument, GetTestName());\n            Assert.True(content == updatedDocument.SomeContent, GetTestName());\n        }\n\n        [Fact]\n        public void UpdateOneField()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateOne<T, TKey, string>(document, x => x.SomeContent, content);\n            // Assert\n            Assert.True(result, GetTestName());\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument, GetTestName());\n            Assert.True(content == updatedDocument.SomeContent, GetTestName());\n        }\n\n        [Fact]\n        public async Task UpdateOneFieldAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateOneAsync<T, TKey, string>(document, x => x.SomeContent, content);\n            // Assert\n            Assert.True(result, GetTestName());\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument, GetTestName());\n            Assert.True(content == updatedDocument.SomeContent, GetTestName());\n        }\n\n        [Fact]\n        public void UpdateOneFieldWithFilter()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateOne<T, TKey, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.True(result, GetTestName());\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument, GetTestName());\n            Assert.True(content == updatedDocument.SomeContent, GetTestName());\n        }\n\n        [Fact]\n        public async Task UpdateOneFieldWithFilterAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateOneAsync<T, TKey, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.True(result, GetTestName());\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument, GetTestName());\n            Assert.True(content == updatedDocument.SomeContent, GetTestName());\n        }\n\n        [Fact]\n        public async Task UpdateOneAsyncWithUpdateDefinition()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = MongoDB.Driver.Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n\n            // Act\n            var result = await SUT.UpdateOneAsync<T, TKey>(document, updateDef);\n            // Assert\n            Assert.True(result);\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument);\n            Assert.True(childrenToAdd[0].Type == updatedDocument.Children[0].Type, GetTestName());\n            Assert.True(childrenToAdd[0].Value == updatedDocument.Children[0].Value, GetTestName());\n            Assert.True(childrenToAdd[1].Type == updatedDocument.Children[1].Type, GetTestName());\n            Assert.True(childrenToAdd[1].Value == updatedDocument.Children[1].Value, GetTestName());\n        }\n\n        [Fact]\n        public void UpdateOneWithUpdateDefinition()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = MongoDB.Driver.Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n\n            // Act\n            var result = SUT.UpdateOne<T, TKey>(document, updateDef);\n            // Assert\n            Assert.True(result);\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.True(null != updatedDocument);\n            Assert.True(childrenToAdd[0].Type == updatedDocument.Children[0].Type, GetTestName());\n            Assert.True(childrenToAdd[0].Value == updatedDocument.Children[0].Value, GetTestName());\n            Assert.True(childrenToAdd[1].Type == updatedDocument.Children[1].Type, GetTestName());\n            Assert.True(childrenToAdd[1].Value == updatedDocument.Children[1].Value, GetTestName());\n        }\n\n        #endregion Update One\n\n        #region Update Many\n\n        [Fact]\n        public async Task UpdateManyWithLinqFilterAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T, TKey>(documents);\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateManyAsync<T, TKey, string>(x => docIds.Contains(x.Id), x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocument = SUT.GetAll<T, TKey>(x => docIds.Contains(x.Id), PartitionKey);\n\n            Assert.True(updatedDocument.Count == 2);\n            Assert.True(updatedDocument.All(u => u.SomeContent == content), GetTestName());\n        }\n\n        [Fact]\n        public async Task UpdateManyWithFilterDefinitionAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T, TKey>(documents);\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var filterDefinition = Builders<T>.Filter.Where(x => docIds.Contains(x.Id));\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateManyAsync<T, TKey, string>(filterDefinition, x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocument = SUT.GetAll<T, TKey>(x => docIds.Contains(x.Id), PartitionKey);\n\n            Assert.True(updatedDocument.Count == 2);\n            Assert.True(updatedDocument.All(u => u.SomeContent == content), GetTestName());\n        }\n\n        [Fact]\n        public async Task UpdateManyWithLinqFilterAndUpdateDefinitionAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T, TKey>(documents);\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateManyAsync<T, TKey>(x => docIds.Contains(x.Id), updateDef, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocuments = SUT.GetAll<T, TKey>(x => docIds.Contains(x.Id), PartitionKey);\n\n            Assert.True(updatedDocuments.Count == 2);\n            updatedDocuments.ForEach(updatedDocument =>\n            {\n                Assert.True(childrenToAdd[0].Type == updatedDocument.Children[0].Type, GetTestName());\n                Assert.True(childrenToAdd[0].Value == updatedDocument.Children[0].Value, GetTestName());\n                Assert.True(childrenToAdd[1].Type == updatedDocument.Children[1].Type, GetTestName());\n                Assert.True(childrenToAdd[1].Value == updatedDocument.Children[1].Value, GetTestName());\n            });\n        }\n\n        [Fact]\n        public async Task UpdateManyWithFilterAndUpdateDefinitionsAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T, TKey>(documents);\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var filterDefinition = Builders<T>.Filter.Where(x => docIds.Contains(x.Id));\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateManyAsync<T, TKey>(filterDefinition, updateDef, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocuments = SUT.GetAll<T, TKey>(x => docIds.Contains(x.Id), PartitionKey);\n\n            Assert.True(updatedDocuments.Count == 2);\n            updatedDocuments.ForEach(updatedDocument =>\n            {\n                Assert.True(childrenToAdd[0].Type == updatedDocument.Children[0].Type, GetTestName());\n                Assert.True(childrenToAdd[0].Value == updatedDocument.Children[0].Value, GetTestName());\n                Assert.True(childrenToAdd[1].Type == updatedDocument.Children[1].Type, GetTestName());\n                Assert.True(childrenToAdd[1].Value == updatedDocument.Children[1].Value, GetTestName());\n            });\n        }\n\n\n        [Fact]\n        public void UpdateManyWithLinqFilter()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T, TKey>(documents);\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateMany<T, TKey, string>(x => docIds.Contains(x.Id), x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocument = SUT.GetAll<T, TKey>(x => docIds.Contains(x.Id), PartitionKey);\n            Assert.True(updatedDocument.Count == 2);\n            Assert.True(updatedDocument.All(u => u.SomeContent == content), GetTestName());\n        }\n\n        [Fact]\n        public void UpdateManyWithFilterDefinition()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T, TKey>(documents);\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var filterDefinition = Builders<T>.Filter.Where(x => docIds.Contains(x.Id));\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateMany<T, TKey, string>(filterDefinition, x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocument = SUT.GetAll<T, TKey>(x => docIds.Contains(x.Id), PartitionKey);\n\n            Assert.True(updatedDocument.Count == 2);\n            Assert.True(updatedDocument.All(u => u.SomeContent == content), GetTestName());\n        }\n\n        [Fact]\n        public void UpdateManyWithLinqFilterAndUpdateDefinition()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T, TKey>(documents);\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateMany<T, TKey>(x => docIds.Contains(x.Id), updateDef, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocuments = SUT.GetAll<T, TKey>(x => docIds.Contains(x.Id), PartitionKey);\n\n            Assert.True(updatedDocuments.Count == 2);\n            updatedDocuments.ForEach(updatedDocument =>\n            {\n                Assert.True(childrenToAdd[0].Type == updatedDocument.Children[0].Type, GetTestName());\n                Assert.True(childrenToAdd[0].Value == updatedDocument.Children[0].Value, GetTestName());\n                Assert.True(childrenToAdd[1].Type == updatedDocument.Children[1].Type, GetTestName());\n                Assert.True(childrenToAdd[1].Value == updatedDocument.Children[1].Value, GetTestName());\n            });\n        }\n\n        [Fact]\n        public void UpdateManyWithFilterAndUpdateDefinitions()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(2);\n            SUT.AddMany<T, TKey>(documents);\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n\n            var docIds = documents.Select(u => u.Id).ToArray();\n            var filterDefinition = Builders<T>.Filter.Where(x => docIds.Contains(x.Id));\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateMany<T, TKey>(filterDefinition, updateDef, PartitionKey);\n            // Assert\n            Assert.True(result == 2, GetTestName());\n            var updatedDocuments = SUT.GetAll<T, TKey>(x => docIds.Contains(x.Id), PartitionKey);\n\n            Assert.True(updatedDocuments.Count == 2);\n            updatedDocuments.ForEach(updatedDocument =>\n            {\n                Assert.True(childrenToAdd[0].Type == updatedDocument.Children[0].Type, GetTestName());\n                Assert.True(childrenToAdd[0].Value == updatedDocument.Children[0].Value, GetTestName());\n                Assert.True(childrenToAdd[1].Type == updatedDocument.Children[1].Type, GetTestName());\n                Assert.True(childrenToAdd[1].Value == updatedDocument.Children[1].Value, GetTestName());\n            });\n        }\n\n\n        #endregion Update Many\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/Infrastructure/MongoDbTestFixture.cs",
    "content": "﻿using MongoDbGenericRepository;\nusing MongoDbGenericRepository.Models;\nusing System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace CoreIntegrationTests.Infrastructure\n{\n    public class MongoDbTestFixture<T, TKey> : IDisposable\n        where T : IDocument<TKey>, new()\n        where TKey : IEquatable<TKey>\n    {\n\n        public IMongoDbContext Context;\n\n        public MongoDbTestFixture()\n        {\n        }\n\n        public string PartitionKey { get; set; }\n\n        public static ConcurrentBag<T> DocsToDelete { get; set; } = new ConcurrentBag<T>();\n\n        public virtual void Dispose()\n        {\n\n            if (DocsToDelete.Any())\n            {\n                TestRepository.Instance.DeleteMany<T, TKey>(DocsToDelete.ToList());\n            }\n        }\n\n        public T CreateTestDocument()\n        {\n            var doc = new T();\n            DocsToDelete.Add(doc);\n            return doc;\n        }\n\n        public List<T> CreateTestDocuments(int numberOfDocumentsToCreate)\n        {\n            var docs = new List<T>();\n            for (var i = 0; i < numberOfDocumentsToCreate; i++)\n            {\n                var doc = new T();\n                docs.Add(doc);\n                DocsToDelete.Add(doc);\n            }\n            return docs;\n        }\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/Infrastructure/RandomExtensions.cs",
    "content": "﻿using System;\n\nnamespace CoreIntegrationTests.Infrastructure\n{\n    // Thanks BlueRaja - Danny Pflughoeft https://stackoverflow.com/a/13095144/5103354\n    /// <summary>\n    /// Extensions for the random number generator <see cref=\"Random\"/>\n    /// </summary>\n    public static class RandomExtensions\n    {\n\n        /// <summary>\n        /// Returns a random long from min (inclusive) to max (exclusive)\n        /// </summary>\n        /// <param name=\"random\">The given random instance</param>\n        /// <param name=\"min\">The inclusive minimum bound</param>\n        /// <param name=\"max\">The exclusive maximum bound.  Must be greater than min</param>\n        public static long NextLong(this Random random, long min, long max)\n        {\n            if (max <= min)\n                throw new ArgumentOutOfRangeException(\"max\", \"max must be > min!\");\n\n            //Working with ulong so that modulo works correctly with values > long.MaxValue\n            ulong uRange = (ulong)(max - min);\n\n            //Prevent a modulo bias; see https://stackoverflow.com/a/10984975/238419\n            //for more information.\n            //In the worst case, the expected number of calls is 2 (though usually it's\n            //much closer to 1) so this loop doesn't really hurt performance at all.\n            ulong ulongRand;\n            do\n            {\n                byte[] buf = new byte[8];\n                random.NextBytes(buf);\n                ulongRand = (ulong)BitConverter.ToInt64(buf, 0);\n            } while (ulongRand > ulong.MaxValue - ((ulong.MaxValue % uRange) + 1) % uRange);\n\n            return (long)(ulongRand % uRange) + min;\n        }\n\n        /// <summary>\n        /// Returns a random long from 0 (inclusive) to max (exclusive)\n        /// </summary>\n        /// <param name=\"random\">The given random instance</param>\n        /// <param name=\"max\">The exclusive maximum bound.  Must be greater than 0</param>\n        public static long NextLong(this Random random, long max)\n        {\n            return random.NextLong(0, max);\n        }\n\n        /// <summary>\n        /// Returns a random long over all possible values of long (except long.MaxValue, similar to\n        /// random.Next())\n        /// </summary>\n        /// <param name=\"random\">The given random instance</param>\n        public static long NextLong(this Random random)\n        {\n            return random.NextLong(long.MinValue, long.MaxValue);\n        }\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/Infrastructure/TestClasses.cs",
    "content": "﻿using MongoDB.Bson;\nusing MongoDB.Bson.Serialization.Attributes;\nusing MongoDbGenericRepository.Models;\nusing MongoDbGenericRepository.Utils;\nusing System;\nusing System.Collections.Generic;\n\nnamespace CoreIntegrationTests.Infrastructure\n{\n    public class ProjectedGroup\n    {\n        public int Key { get; set; }\n        public List<string> Content { get; set; }\n    }\n\n    public class MyTestProjection\n    {\n        public string SomeContent { get; set; }\n        public DateTime SomeDate { get; set; }\n    }\n\n    public class Nested\n    {\n        public DateTime SomeDate { get; set; }\n        [BsonRepresentation(BsonType.Decimal128)]\n        public decimal SomeAmount { get; set; }\n    }\n\n    public class Child\n    {\n        public Child(string type, string value)\n        {\n            Type = type;\n            Value = value;\n        }\n\n        public string Type { get; set; }\n        public string Value { get; set; }\n    }\n\n    public class TestDoc : Document\n    {\n        public TestDoc()\n        {\n            Version = 2;\n            Nested = new Nested\n            {\n                SomeDate = DateTime.UtcNow\n            };\n            Children = new List<Child>();\n        }\n\n        public int SomeValue { get; set; }\n\n        public string SomeContent { get; set; }\n        public string SomeContent2 { get; set; }\n        public string SomeContent3 { get; set; }\n\n        public int GroupingKey { get; set; }\n\n        public Nested Nested { get; set; }\n\n        public List<Child> Children { get; set; }\n\n    }\n\n    public class TestDoc<TKey> : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n    {\n        [BsonId]\n        public TKey Id { get; set; }\n        public int Version { get; set; }\n\n        public TestDoc()\n        {\n            InitializeFields();\n            Version = 2;\n            Nested = new Nested\n            {\n                SomeDate = DateTime.UtcNow\n            };\n            Children = new List<Child>();\n        }\n\n        public int GroupingKey { get; set; }\n        public string SomeContent { get; set; }\n        public string SomeContent4 { get; set; }\n        public string SomeContent5 { get; set; }\n\n        public Nested Nested { get; set; }\n\n        public List<Child> Children { get; set; }\n\n        public TId Init<TId>()\n        {\n            return IdGenerator.GetId<TId>();\n        }\n\n        private void InitializeFields()\n        {\n            Id = Init<TKey>();\n        }\n    }\n}\n"
  },
  {
    "path": "CoreIntegrationTests/Infrastructure/TestRepository.cs",
    "content": "﻿using MongoDB.Bson;\nusing MongoDbGenericRepository;\nusing System;\n\nnamespace CoreIntegrationTests.Infrastructure\n{\n    public interface ITestRepository<TKey> : IBaseMongoRepository<TKey> where TKey : IEquatable<TKey>\n    {\n        void DropTestCollection<TDocument>();\n        void DropTestCollection<TDocument>(string partitionKey);\n    }\n\n    public class TestTKeyRepository<TKey> : BaseMongoRepository<TKey>, ITestRepository<TKey> where TKey : IEquatable<TKey>\n    {\n        const string connectionString = \"mongodb://localhost:27017/MongoDbTests\";\n        private static readonly ITestRepository<TKey> _instance = new TestTKeyRepository<TKey>(connectionString);\n        /// <inheritdoc />\n        private TestTKeyRepository(string connectionString) : base(connectionString)\n        {\n        }\n\n        public static ITestRepository<TKey> Instance\n        {\n            get\n            {\n                return _instance;\n            }\n        }\n\n        public void DropTestCollection<TDocument>()\n        {\n            MongoDbContext.DropCollection<TDocument>();\n        }\n\n        public void DropTestCollection<TDocument>(string partitionKey)\n        {\n            MongoDbContext.DropCollection<TDocument>(partitionKey);\n        }\n    }\n\n    /// <summary>\n    /// A singleton implementation of the TestRepository\n    /// </summary>\n    public sealed class TestRepository : BaseMongoRepository, ITestRepository\n    {\n\n        const string connectionString = \"mongodb://localhost:27017\";\n        private static readonly ITestRepository _instance = new TestRepository(connectionString, \"MongoDbTests\");\n\n        // Explicit static constructor to tell C# compiler\n        // not to mark type as beforefieldinit\n        static TestRepository()\n        {\n        }\n\n        /// <inheritdoc />\n        private TestRepository(string connectionString, string databaseName) : base(connectionString, databaseName)\n        {\n        }\n\n        public static ITestRepository Instance\n        {\n            get\n            {\n                return _instance;\n            }\n        }\n\n        public void DropTestCollection<TDocument>()\n        {\n            MongoDbContext.DropCollection<TDocument>();\n        }\n\n        public void DropTestCollection<TDocument>(string partitionKey)\n        {\n            MongoDbContext.DropCollection<TDocument>(partitionKey);\n        }\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/.editorconfig",
    "content": "# All Files\n[*]\ncharset = utf-8\nindent_style = space\nindent_size = 4\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n#########################################\n# File Extension Settings\n##########################################\n\n# .NET Style Rules\n# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#net-style-rules\n[*.cs]\n# \"this.\" and \"Me.\" qualifiers\ndotnet_style_qualification_for_field = false:warning\ndotnet_style_qualification_for_property = false:warning\ndotnet_style_qualification_for_method = false:warning\ndotnet_style_qualification_for_event = false:warning\n# Language keywords instead of framework type names for type references\ndotnet_style_predefined_type_for_locals_parameters_members = true:warning\ndotnet_style_predefined_type_for_member_access = true:warning\n# Modifier preferences\ndotnet_style_require_accessibility_modifiers = always:warning\ncsharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning\nvisual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:warning\ndotnet_style_readonly_field = true:warning\n# Parentheses preferences\ndotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning\ndotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning\ndotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning\ndotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning\n# Expression-level preferences\ndotnet_style_object_initializer = true:warning\ndotnet_style_collection_initializer = true:warning\ndotnet_style_explicit_tuple_names = true:warning\ndotnet_style_prefer_inferred_tuple_names = true:warning\ndotnet_style_prefer_inferred_anonymous_type_member_names = true:warning\ndotnet_style_prefer_auto_properties = true:warning\ndotnet_style_prefer_conditional_expression_over_assignment = false:suggestion\ndotnet_diagnostic.IDE0045.severity = suggestion\ndotnet_style_prefer_conditional_expression_over_return = false:suggestion\ndotnet_diagnostic.IDE0046.severity = suggestion\ndotnet_style_prefer_compound_assignment = true:warning\ndotnet_style_prefer_simplified_interpolation = true:warning\ndotnet_style_prefer_simplified_boolean_expressions = true:warning\n# Null-checking preferences\ndotnet_style_coalesce_expression = true:warning\ndotnet_style_null_propagation = true:warning\ndotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning\n# File header preferences\n# file_header_template = <copyright file=\"{fileName}\" company=\"PROJECT-AUTHOR\">\\n© PROJECT-AUTHOR\\n</copyright>\n# If you use StyleCop, you'll need to disable SA1636: File header copyright text should match.\n# dotnet_diagnostic.SA1636.severity = none\n# Undocumented\ndotnet_style_operator_placement_when_wrapping = end_of_line:warning\ncsharp_style_prefer_null_check_over_type_check = true:warning\ndotnet_analyzer_diagnostic.severity = warning\ndotnet_code_quality_unused_parameters = all:warning\ndotnet_remove_unnecessary_suppression_exclusions = none:warning\ndotnet_sort_system_directives_first = true\ndotnet_separate_import_directive_groups = false\ndotnet_style_namespace_match_folder = true:suggestion\ndotnet_diagnostic.IDE0130.severity = suggestion\ndotnet_naming_style.camel_case_style.capitalization = camel_case\ndotnet_naming_style.pascal_case_style.capitalization = pascal_case\ndotnet_naming_style.first_upper_style.capitalization = first_word_upper\ndotnet_naming_style.prefix_interface_with_i_style.capitalization = pascal_case\ndotnet_naming_style.prefix_interface_with_i_style.required_prefix = I\ndotnet_naming_style.prefix_type_parameters_with_t_style.capitalization = pascal_case\ndotnet_naming_style.prefix_type_parameters_with_t_style.required_prefix = T\ndotnet_naming_style.disallowed_style.capitalization  = pascal_case\ndotnet_naming_style.disallowed_style.required_prefix = ____RULE_VIOLATION____\ndotnet_naming_style.disallowed_style.required_suffix = ____RULE_VIOLATION____\ndotnet_naming_style.internal_error_style.capitalization  = pascal_case\ndotnet_naming_style.internal_error_style.required_prefix = ____INTERNAL_ERROR____\ndotnet_naming_style.internal_error_style.required_suffix = ____INTERNAL_ERROR____\ndotnet_naming_symbols.public_protected_constant_fields_group.applicable_accessibilities = public, protected, protected_internal\ndotnet_naming_symbols.public_protected_constant_fields_group.required_modifiers         = const\ndotnet_naming_symbols.public_protected_constant_fields_group.applicable_kinds           = field\ndotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.symbols    = public_protected_constant_fields_group\ndotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.style      = pascal_case_style\ndotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.severity   = warning\ndotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_accessibilities = public, protected, protected_internal\ndotnet_naming_symbols.public_protected_static_readonly_fields_group.required_modifiers         = static, readonly\ndotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_kinds           = field\ndotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.symbols    = public_protected_static_readonly_fields_group\ndotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.style      = pascal_case_style\ndotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.severity   = warning\ndotnet_naming_symbols.other_public_protected_fields_group.applicable_accessibilities = public, protected, protected_internal\ndotnet_naming_symbols.other_public_protected_fields_group.applicable_kinds           = field\ndotnet_naming_rule.other_public_protected_fields_disallowed_rule.symbols             = other_public_protected_fields_group\ndotnet_naming_rule.other_public_protected_fields_disallowed_rule.style               = disallowed_style\ndotnet_naming_rule.other_public_protected_fields_disallowed_rule.severity            = error\ndotnet_naming_symbols.stylecop_constant_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private\ndotnet_naming_symbols.stylecop_constant_fields_group.required_modifiers         = const\ndotnet_naming_symbols.stylecop_constant_fields_group.applicable_kinds           = field\ndotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.symbols    = stylecop_constant_fields_group\ndotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.style      = pascal_case_style\ndotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.severity   = warning\ndotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private\ndotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers         = static, readonly\ndotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_kinds           = field\ndotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.symbols    = stylecop_static_readonly_fields_group\ndotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.style      = pascal_case_style\ndotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.severity   = warning\ndotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected\ndotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_kinds           = field\ndotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.symbols               = stylecop_fields_must_be_private_group\ndotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.style                 = disallowed_style\ndotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.severity              = error\ndotnet_naming_symbols.stylecop_private_fields_group.applicable_accessibilities = private\ndotnet_naming_symbols.stylecop_private_fields_group.applicable_kinds           = field\ndotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.symbols     = stylecop_private_fields_group\ndotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.style       = camel_case_style\ndotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.severity    = warning\ndotnet_naming_symbols.stylecop_local_fields_group.applicable_accessibilities = local\ndotnet_naming_symbols.stylecop_local_fields_group.applicable_kinds           = local\ndotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.symbols     = stylecop_local_fields_group\ndotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.style       = camel_case_style\ndotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.severity    = silent\ndotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_accessibilities = *\ndotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_kinds           = field\ndotnet_naming_rule.sanity_check_uncovered_field_case_rule.symbols  = sanity_check_uncovered_field_case_group\ndotnet_naming_rule.sanity_check_uncovered_field_case_rule.style    = internal_error_style\ndotnet_naming_rule.sanity_check_uncovered_field_case_rule.severity = error\ndotnet_naming_symbols.element_group.applicable_kinds = namespace, class, enum, struct, delegate, event, method, property\ndotnet_naming_rule.element_rule.symbols              = element_group\ndotnet_naming_rule.element_rule.style                = pascal_case_style\ndotnet_naming_rule.element_rule.severity             = warning\ndotnet_naming_symbols.interface_group.applicable_kinds = interface\ndotnet_naming_rule.interface_rule.symbols              = interface_group\ndotnet_naming_rule.interface_rule.style                = prefix_interface_with_i_style\ndotnet_naming_rule.interface_rule.severity             = warning\ndotnet_naming_symbols.type_parameter_group.applicable_kinds = type_parameter\ndotnet_naming_rule.type_parameter_rule.symbols              = type_parameter_group\ndotnet_naming_rule.type_parameter_rule.style                = prefix_type_parameters_with_t_style\ndotnet_naming_rule.type_parameter_rule.severity             = warning\ndotnet_naming_symbols.parameters_group.applicable_kinds = parameter\ndotnet_naming_rule.parameters_rule.symbols              = parameters_group\ndotnet_naming_rule.parameters_rule.style                = camel_case_style\ndotnet_naming_rule.parameters_rule.severity             = warning\ncsharp_style_var_for_built_in_types = true:warning\ncsharp_style_var_when_type_is_apparent = true:warning\ncsharp_style_var_elsewhere = true:warning\ncsharp_style_expression_bodied_methods = true:warning\ncsharp_style_expression_bodied_constructors = true:warning\ncsharp_style_expression_bodied_operators = true:warning\ncsharp_style_expression_bodied_properties = true:warning\ncsharp_style_expression_bodied_indexers = true:warning\ncsharp_style_expression_bodied_accessors = true:warning\ncsharp_style_expression_bodied_lambdas = true:warning\ncsharp_style_expression_bodied_local_functions = true:warning\ncsharp_style_pattern_matching_over_is_with_cast_check = true:warning\ncsharp_style_pattern_matching_over_as_with_null_check = true:warning\ncsharp_style_prefer_switch_expression = true:warning\ncsharp_style_prefer_pattern_matching = true:warning\ncsharp_style_prefer_not_pattern = true:warning\ncsharp_style_inlined_variable_declaration = true:warning\ncsharp_prefer_simple_default_expression = true:warning\ncsharp_style_pattern_local_over_anonymous_function = true:warning\ncsharp_style_deconstructed_variable_declaration = true:warning\ncsharp_style_prefer_index_operator = true:warning\ncsharp_style_prefer_range_operator = true:warning\ncsharp_style_implicit_object_creation_when_type_is_apparent = true:warning\ncsharp_style_throw_expression = true:warning\ncsharp_style_conditional_delegate_call = true:warning\ncsharp_prefer_braces = true:warning\ncsharp_prefer_simple_using_statement = true:suggestion\ndotnet_diagnostic.IDE0063.severity = suggestion\ncsharp_using_directive_placement = outside_namespace\ncsharp_prefer_static_local_function = true:warning\ncsharp_style_unused_value_expression_statement_preference = discard_variable:suggestion\ndotnet_diagnostic.IDE0058.severity = suggestion\ncsharp_style_unused_value_assignment_preference = discard_variable:suggestion\ndotnet_diagnostic.IDE0059.severity = suggestion\ncsharp_new_line_before_open_brace = all\ncsharp_new_line_before_else = true\ncsharp_new_line_before_catch = true\ncsharp_new_line_before_finally = true\ncsharp_new_line_before_members_in_object_initializers = true\ncsharp_new_line_before_members_in_anonymous_types = true\ncsharp_new_line_between_query_expression_clauses = true\ncsharp_indent_case_contents = true\ncsharp_indent_switch_labels = true\ncsharp_indent_labels = no_change\ncsharp_indent_block_contents = true\ncsharp_indent_braces = false\ncsharp_indent_case_contents_when_block = false\ncsharp_space_after_cast = false\ncsharp_space_after_keywords_in_control_flow_statements = true\ncsharp_space_between_parentheses = false\ncsharp_space_before_colon_in_inheritance_clause = true\ncsharp_space_after_colon_in_inheritance_clause = true\ncsharp_space_around_binary_operators = before_and_after\ncsharp_space_between_method_declaration_parameter_list_parentheses = false\ncsharp_space_between_method_declaration_empty_parameter_list_parentheses = false\ncsharp_space_between_method_declaration_name_and_open_parenthesis = false\ncsharp_space_between_method_call_parameter_list_parentheses = false\ncsharp_space_between_method_call_empty_parameter_list_parentheses = false\ncsharp_space_between_method_call_name_and_opening_parenthesis = false\ncsharp_space_after_comma = true\ncsharp_space_before_comma = false\ncsharp_space_after_dot = false\ncsharp_space_before_dot = false\ncsharp_space_after_semicolon_in_for_statement = true\ncsharp_space_before_semicolon_in_for_statement = false\ncsharp_space_around_declaration_statements = false\ncsharp_space_before_open_square_brackets = false\ncsharp_space_between_empty_square_brackets = false\ncsharp_space_between_square_brackets = false\ncsharp_preserve_single_line_statements = false\ncsharp_preserve_single_line_blocks = true\ncsharp_style_namespace_declarations = file_scoped:warning\ndotnet_diagnostic.CA1707.severity = none\n\n\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddManyAsyncTests.cs",
    "content": "using System;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.AddTests;\n\npublic class AddManyAsyncTests : TestMongoRepositoryContext\n{\n    [Fact]\n    public async Task WithDocument_ShouldAddOne()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        await Sut.AddManyAsync(documents);\n\n        // Assert\n        Creator.Verify(x => x.AddManyAsync<TestDocument, Guid>(documents, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithDocumentAndCancellationToken_ShouldAddOne()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        await Sut.AddManyAsync(documents, token);\n\n        // Assert\n        Creator.Verify(x => x.AddManyAsync<TestDocument, Guid>(documents, token), Times.Once);\n    }\n\n    #region Keyed\n\n    [Fact]\n    public async Task Keyed_WithDocument_ShouldAddOne()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        await Sut.AddManyAsync<TestDocumentWithKey<int>, int>(documents);\n\n        // Assert\n        Creator.Verify(x => x.AddManyAsync<TestDocumentWithKey<int>, int>(documents, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithDocumentAndCancellationToken_ShouldAddOne()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var token = new CancellationToken(true);\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        await Sut.AddManyAsync<TestDocumentWithKey<int>, int>(documents, token);\n\n        // Assert\n        Creator.Verify(x => x.AddManyAsync<TestDocumentWithKey<int>, int>(documents, token), Times.Once);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddManyTests.cs",
    "content": "using System;\nusing System.Linq;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.AddTests;\n\npublic class AddManyTests : TestMongoRepositoryContext\n{\n\n    [Fact]\n    public void WithDocument_ShouldAddOne()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        Sut.AddMany(documents);\n\n        // Assert\n        Creator.Verify(x => x.AddMany<TestDocument, Guid>(documents, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithDocumentAndCancellationToken_ShouldAddOne()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        Sut.AddMany(documents, token);\n\n        // Assert\n        Creator.Verify(x => x.AddMany<TestDocument, Guid>(documents, token), Times.Once);\n    }\n\n    #region Keyed\n\n    [Fact]\n    public void Keyed_WithDocument_ShouldAddOne()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        Sut.AddMany<TestDocumentWithKey<int>, int>(documents);\n\n        // Assert\n        Creator.Verify(x => x.AddMany<TestDocumentWithKey<int>, int>(documents, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithDocumentAndCancellationToken_ShouldAddOne()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var token = new CancellationToken(true);\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        Sut.AddMany<TestDocumentWithKey<int>, int>(documents, token);\n\n        // Assert\n        Creator.Verify(x => x.AddMany<TestDocumentWithKey<int>, int>(documents, token), Times.Once);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddOneAsyncTests.cs",
    "content": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.AddTests;\n\npublic class AddOneAsyncTests : TestMongoRepositoryContext\n{\n    [Fact]\n    public async Task WithDocument_ShouldAddOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        await Sut.AddOneAsync(document);\n\n        // Assert\n        Creator.Verify(x => x.AddOneAsync<TestDocument, Guid>(document, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithDocumentAndCancellationToken_ShouldAddOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        await Sut.AddOneAsync(document, token);\n\n        // Assert\n        Creator.Verify(x => x.AddOneAsync<TestDocument, Guid>(document, token), Times.Once);\n    }\n\n    #region Keyed\n\n    [Fact]\n    public async Task Keyed_WithDocument_ShouldAddOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        await Sut.AddOneAsync<TestDocumentWithKey<int>, int>(document);\n\n        // Assert\n        Creator.Verify(x => x.AddOneAsync<TestDocumentWithKey<int>, int>(document, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithDocumentAndCancellationToken_ShouldAddOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        await Sut.AddOneAsync<TestDocumentWithKey<int>, int>(document, token);\n\n        // Assert\n        Creator.Verify(x => x.AddOneAsync<TestDocumentWithKey<int>, int>(document, token), Times.Once);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddOneTests.cs",
    "content": "using System;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.AddTests;\n\npublic class AddOneTests : TestMongoRepositoryContext\n{\n    [Fact]\n    public void WithDocument_ShouldAddOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        Sut.AddOne(document);\n\n        // Assert\n        Creator.Verify(x => x.AddOne<TestDocument, Guid>(document, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithDocumentAndCancellationToken_ShouldAddOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        Sut.AddOne(document, token);\n\n        // Assert\n        Creator.Verify(x => x.AddOne<TestDocument, Guid>(document, token), Times.Once);\n    }\n\n    #region Keyed\n\n    [Fact]\n    public void Keyed_WithDocument_ShouldAddOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        Sut.AddOne<TestDocumentWithKey<int>, int>(document);\n\n        // Assert\n        Creator.Verify(x => x.AddOne<TestDocumentWithKey<int>, int>(document, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithDocumentAndCancellationToken_ShouldAddOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        Sut.AddOne<TestDocumentWithKey<int>, int>(document, token);\n\n        // Assert\n        Creator.Verify(x => x.AddOne<TestDocumentWithKey<int>, int>(document, token), Times.Once);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/DeleteTests/DeleteManyAsyncTests.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.DeleteTests;\n\npublic class DeleteManyAsyncTests : TestMongoRepositoryContext\n{\n    [Fact]\n    public async Task WithDocuments_ShouldDeleteMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var count = Fixture.Create<long>();\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocument, Guid>(It.IsAny<IEnumerable<TestDocument>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync(documents);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocument, Guid>(documents, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithDocumentsAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var count = Fixture.Create<long>();\n        var cancellationToken = new CancellationToken(true);\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocument, Guid>(It.IsAny<IEnumerable<TestDocument>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync(documents, cancellationToken);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocument, Guid>(documents, cancellationToken), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilter_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocument, Guid>(\n                It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync(filter);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocument, Guid>(filter, null, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocument, Guid>(\n                It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync(filter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocument, Guid>(filter, null, token), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKey_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocument, Guid>(\n                It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync(filter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocument, Guid>(filter, partitionKey, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKeyAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocument, Guid>(\n                It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocument, Guid>(filter, partitionKey, token), Times.Once);\n    }\n\n    #region Keyed\n\n    [Fact]\n    public async Task Keyed_WithDocuments_ShouldDeleteMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var count = Fixture.Create<long>();\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(It.IsAny<IEnumerable<TestDocumentWithKey<int>>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync<TestDocumentWithKey<int>, int>(documents);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(documents, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithDocumentsAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var count = Fixture.Create<long>();\n        var cancellationToken = new CancellationToken(true);\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(It.IsAny<IEnumerable<TestDocumentWithKey<int>>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync<TestDocumentWithKey<int>, int>(documents, cancellationToken);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(documents, cancellationToken), Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilter_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(\n                It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync<TestDocumentWithKey<int>, int>(filter);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(\n                It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync<TestDocumentWithKey<int>, int>(filter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(filter, null, token), Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndPartitionKey_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(\n                It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync<TestDocumentWithKey<int>, int>(filter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndPartitionKeyAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(\n                It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, token), Times.Once);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/DeleteTests/DeleteManyTests.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.DeleteTests;\n\npublic class DeleteManyTests : TestMongoRepositoryContext\n{\n    [Fact]\n    public void WithDocuments_ShouldDeleteMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var count = Fixture.Create<long>();\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocument, Guid>(It.IsAny<IEnumerable<TestDocument>>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany(documents);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocument, Guid>(documents, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithDocumentsAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocument, Guid>(It.IsAny<IEnumerable<TestDocument>>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany(documents, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocument, Guid>(documents, token), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilter_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocument, Guid>(It.IsAny<Expression<Func<TestDocument, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany(filter);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocument, Guid>(filter, null, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocument, Guid>(It.IsAny<Expression<Func<TestDocument, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany(filter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocument, Guid>(filter, null, token), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKey_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocument, Guid>(It.IsAny<Expression<Func<TestDocument, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany(filter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocument, Guid>(filter, partitionKey, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKeyAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocument, Guid>(It.IsAny<Expression<Func<TestDocument, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocument, Guid>(filter, partitionKey, token), Times.Once);\n    }\n\n    #region Keyed\n\n    [Fact]\n    public void Keyed_WithDocuments_ShouldDeleteMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var count = Fixture.Create<long>();\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocumentWithKey<int>, int>(It.IsAny<IEnumerable<TestDocumentWithKey<int>>>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany<TestDocumentWithKey<int>, int>(documents);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocumentWithKey<int>, int>(documents, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithDocumentsAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocumentWithKey<int>, int>(It.IsAny<IEnumerable<TestDocumentWithKey<int>>>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany<TestDocumentWithKey<int>, int>(documents, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocumentWithKey<int>, int>(documents, token), Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilter_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocumentWithKey<int>, int>(It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(), null, CancellationToken.None))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany<TestDocumentWithKey<int>, int>(filter);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocumentWithKey<int>, int>(It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany<TestDocumentWithKey<int>, int>(filter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocumentWithKey<int>, int>(filter, null, token), Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndPartitionKey_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocumentWithKey<int>, int>(It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany<TestDocumentWithKey<int>, int>(filter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndPartitionKeyAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocumentWithKey<int>, int>(It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany<TestDocumentWithKey<int>, int>(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocumentWithKey<int>, int>(filter, partitionKey, token), Times.Once);\n    }\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/DeleteTests/DeleteOneAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.DeleteTests;\n\npublic class DeleteOneAsyncTests : TestMongoRepositoryContext\n{\n    [Fact]\n    public async Task WithDocument_ShouldDeleteOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var count = Fixture.Create<long>();\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocument, Guid>(It.IsAny<TestDocument>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync(document);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocument, Guid>(document, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithDocumentAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocument, Guid>(It.IsAny<TestDocument>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync(document, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocument, Guid>(document, token), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilter_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocument, Guid>(It.IsAny<Expression<Func<TestDocument, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync(filter);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocument, Guid>(filter, null, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocument, Guid>(It.IsAny<Expression<Func<TestDocument, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync(filter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocument, Guid>(filter, null, token), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKey_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocument, Guid>(It.IsAny<Expression<Func<TestDocument, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync(filter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocument, Guid>(filter, partitionKey, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKeyAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocument, Guid>(It.IsAny<Expression<Func<TestDocument, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocument, Guid>(filter, partitionKey, token), Times.Once);\n    }\n\n    #region Keyed\n\n    [Fact]\n    public async Task Keyed_WithDocument_ShouldDeleteOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var count = Fixture.Create<long>();\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<TestDocumentWithKey<int>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync<TestDocumentWithKey<int>, int>(document);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(document, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithDocumentAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<TestDocumentWithKey<int>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync<TestDocumentWithKey<int>, int>(document, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(document, token), Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilter_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync<TestDocumentWithKey<int>, int>(filter);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync<TestDocumentWithKey<int>, int>(filter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(filter, null, token), Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndPartitionKey_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync<TestDocumentWithKey<int>, int>(filter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndPartitionKeyAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, token), Times.Once);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/DeleteTests/DeleteOneTests.cs",
    "content": "﻿namespace CoreUnitTests.BaseMongoRepositoryTests.DeleteTests;\n\nusing System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing FluentAssertions;\nusing Infrastructure;\nusing Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing Moq;\nusing Xunit;\n\npublic class DeleteOneTests : TestMongoRepositoryContext\n{\n    [Fact]\n    public void WithDocument_ShouldDeleteOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var count = Fixture.Create<long>();\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOne<TestDocument, Guid>(It.IsAny<TestDocument>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne(document);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocument, Guid>(document, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithDocumentAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOne<TestDocument, Guid>(It.IsAny<TestDocument>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne(document, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocument, Guid>(document, token), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilter_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOne<TestDocument, Guid>(It.IsAny<Expression<Func<TestDocument, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne(filter);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocument, Guid>(filter, null, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(\n                x => x.DeleteOne<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne(filter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocument, Guid>(filter, null, token), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKey_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(\n                x => x.DeleteOne<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne(filter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocument, Guid>(filter, partitionKey, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKeyAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(\n                x => x.DeleteOne<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocument, Guid>(filter, partitionKey, token), Times.Once);\n    }\n\n    [Fact]\n    public void WithKeyedDocument_ShouldDeleteOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var count = Fixture.Create<long>();\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOne<TestDocumentWithKey<int>, int>(It.IsAny<TestDocumentWithKey<int>>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne<TestDocumentWithKey<int>, int>(document);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocumentWithKey<int>, int>(document, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithKeyedDocumentAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOne<TestDocumentWithKey<int>, int>(It.IsAny<TestDocumentWithKey<int>>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne<TestDocumentWithKey<int>, int>(document, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocumentWithKey<int>, int>(document, token), Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilter_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(\n                x => x.DeleteOne<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne<TestDocumentWithKey<int>, int>(filter);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(\n                x => x.DeleteOne<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne<TestDocumentWithKey<int>, int>(filter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocumentWithKey<int>, int>(filter, null, token), Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndPartitionKey_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(\n                x => x.DeleteOne<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne<TestDocumentWithKey<int>, int>(filter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndPartitionKeyAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(\n                x => x.DeleteOne<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne<TestDocumentWithKey<int>, int>(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocumentWithKey<int>, int>(filter, partitionKey, token), Times.Once);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/IndexTests/BaseIndexTests.cs",
    "content": "using CoreUnitTests.Infrastructure;\nusing MongoDB.Bson;\nusing MongoDB.Driver;\nusing Moq;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.IndexTests;\n\npublic class BaseIndexTests : TestMongoRepositoryContext\n{\n    protected static Mock<IAsyncCursor<BsonDocument>> SetupIndex<TDocument>(BsonDocument index, Mock<IMongoCollection<TDocument>> collection)\n    {\n        var asyncCursor = new Mock<IAsyncCursor<BsonDocument>>();\n        asyncCursor\n            .SetupSequence(x => x.MoveNextAsync(It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true)\n            .ReturnsAsync(false);\n\n        asyncCursor\n            .SetupGet(x => x.Current)\n            .Returns([index]);\n\n        var indexManager = new Mock<IMongoIndexManager<TDocument>>();\n        indexManager\n            .Setup(x => x.ListAsync(It.IsAny<CancellationToken>()))\n            .ReturnsAsync(asyncCursor.Object);\n\n        collection\n            .SetupGet(x => x.Indexes)\n            .Returns(indexManager.Object);\n\n        return asyncCursor;\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/IndexTests/CreateAscendingIndexAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.Models;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.IndexTests;\n\npublic class CreateAscendingIndexAsyncTests : BaseIndexTests\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedFieldExpression = t => t.SomeContent2;\n    private readonly Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;\n\n    [Fact]\n    public async Task WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(fieldExpression);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocument, Guid>(fieldExpression, null, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(fieldExpression, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocument, Guid>(fieldExpression, null, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(fieldExpression, options);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(fieldExpression, options, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(fieldExpression, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocument, Guid>(\n                fieldExpression, null, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(fieldExpression, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocument, Guid>(\n                fieldExpression, null, partitionKey, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(fieldExpression, options, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(fieldExpression, options, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, partitionKey, token));\n    }\n\n    #region Keyed\n\n    [Fact]\n    public async Task Keyed_WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, token));\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/IndexTests/CreateCombinedTextIndexAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.Models;\nusing Moq;\nusing Xunit;\nusing CancellationToken = System.Threading.CancellationToken;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.IndexTests;\n\npublic class CreateCombinedTextIndexAsyncTests : BaseIndexTests\n{\n    private readonly List<Expression<Func<TestDocument, object>>> fieldExpressions = new() {t => t.SomeContent2, t => t.SomeContent3};\n    private readonly List<Expression<Func<TestDocumentWithKey<int>, object>>> keyedFieldExpressions = new() {t => t.SomeContent2, t => t.SomeContent3};\n\n    [Fact]\n    public async Task WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(fieldExpressions);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocument, Guid>(fieldExpressions, null, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(fieldExpressions, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocument, Guid>(fieldExpressions, null, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(fieldExpressions, options);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocument, Guid>(\n                fieldExpressions, options, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(fieldExpressions, options, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocument, Guid>(\n                fieldExpressions, options, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(fieldExpressions, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocument, Guid>(\n                fieldExpressions, null, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(fieldExpressions, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocument, Guid>(\n                fieldExpressions, null, partitionKey, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(fieldExpressions, options, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocument, Guid>(\n                fieldExpressions, options, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(fieldExpressions, options, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocument, Guid>(\n                fieldExpressions, options, partitionKey, token));\n    }\n\n    #region Keyed\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpressions);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpressions, null, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpressions, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpressions, null, null, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpressions, options);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpressions, options, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpressions, options, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpressions, options, null, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpressions, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpressions, null, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpressions, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpressions, null, partitionKey, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpressions, options, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpressions, options, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpressions, options, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpressions, options, partitionKey, token));\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/IndexTests/CreateDescendingIndexAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.Models;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.IndexTests;\n\npublic class CreateDescendingIndexAsyncTests : BaseIndexTests\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedFieldExpression = t => t.SomeContent2;\n    private readonly Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;\n\n    [Fact]\n    public async Task WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(fieldExpression);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocument, Guid>(fieldExpression, null, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(fieldExpression, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocument, Guid>(fieldExpression, null, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(fieldExpression, options);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(fieldExpression, options, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(fieldExpression, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocument, Guid>(\n                fieldExpression, null, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(fieldExpression, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocument, Guid>(\n                fieldExpression, null, partitionKey, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(fieldExpression, options, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(fieldExpression, options, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, partitionKey, token));\n    }\n\n    #region Keyed\n\n    [Fact]\n    public async Task Keyed_WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, token));\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/IndexTests/CreateHashedIndexAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.Models;\nusing Moq;\nusing Xunit;\nusing CancellationToken = System.Threading.CancellationToken;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.IndexTests;\n\npublic class CreateHashedIndexAsyncTests : BaseIndexTests\n{\n    private readonly Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedFieldExpression = t => t.SomeContent2;\n\n    [Fact]\n    public async Task WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(fieldExpression);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocument, Guid>(fieldExpression, null, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(fieldExpression, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocument, Guid>(fieldExpression, null, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(fieldExpression, options);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(fieldExpression, options, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(fieldExpression, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocument, Guid>(\n                fieldExpression, null, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(fieldExpression, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocument, Guid>(\n                fieldExpression, null, partitionKey, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(fieldExpression, options, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(fieldExpression, options, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, partitionKey, token));\n    }\n\n    #region Keyed\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, token));\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/IndexTests/CreateTextIndexAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.Models;\nusing Moq;\nusing Xunit;\nusing CancellationToken = System.Threading.CancellationToken;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.IndexTests;\n\npublic class CreateTextIndexAsyncTests : BaseIndexTests\n{\n    private readonly Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedFieldExpression = t => t.SomeContent2;\n\n    [Fact]\n    public async Task WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(fieldExpression);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocument, Guid>(fieldExpression, null, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(fieldExpression, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocument, Guid>(fieldExpression, null, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(fieldExpression, options);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(fieldExpression, options, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(fieldExpression, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocument, Guid>(\n                fieldExpression, null, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(fieldExpression, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocument, Guid>(\n                fieldExpression, null, partitionKey, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(fieldExpression, options, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(fieldExpression, options, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocument, Guid>(\n                fieldExpression, options, partitionKey, token));\n    }\n\n    #region Keyed\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithKeyedFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, token));\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/IndexTests/DropIndexAsyncTests.cs",
    "content": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.IndexTests;\n\npublic class DropIndexAsyncTests: BaseIndexTests\n{\n    [Fact]\n    public async Task WitIndexName_DropsIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.DropIndexAsync<TestDocument>(indexName);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.DropIndexAsync<TestDocument, Guid>(indexName, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WitIndexNameAndCancellationToken_DropsIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.DropIndexAsync<TestDocument>(indexName, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.DropIndexAsync<TestDocument, Guid>(indexName, null, token));\n    }\n\n    [Fact]\n    public async Task WitIndexNameAndPartitionKey_DropsIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.DropIndexAsync<TestDocument>(indexName, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.DropIndexAsync<TestDocument, Guid>(indexName, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WitIndexNameAndPartitionKeyAndCancellationToken_DropsIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.DropIndexAsync<TestDocument>(indexName, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.DropIndexAsync<TestDocument, Guid>(indexName, partitionKey, token));\n    }\n\n    #region Keyed\n\n    [Fact]\n    public async Task Keyed_WithIndexName_DropsIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.DropIndexAsync<TestDocumentWithKey<int>, int>(indexName);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.DropIndexAsync<TestDocumentWithKey<int>, int>(indexName, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithIndexNameAndCancellationToken_DropsIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.DropIndexAsync<TestDocumentWithKey<int>, int>(indexName, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.DropIndexAsync<TestDocumentWithKey<int>, int>(indexName, null, token));\n    }\n\n    [Fact]\n    public async Task Keyed_WithIndexNameAndPartitionKey_DropsIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.DropIndexAsync<TestDocumentWithKey<int>, int>(indexName, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.DropIndexAsync<TestDocumentWithKey<int>, int>(indexName, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task Keyed_WithIndexNameAndPartitionKeyAndCancellationToken_DropsIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.DropIndexAsync<TestDocumentWithKey<int>, int>(indexName, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.DropIndexAsync<TestDocumentWithKey<int>, int>(indexName, partitionKey, token));\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/IndexTests/GetIndexNamesAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.IndexTests;\n\npublic class GetIndexNamesAsyncTests : BaseIndexTests\n{\n    [Fact]\n    public async Task WithNoParameters_ReturnsIndexNames()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n        var indexName = Fixture.Create<string>();\n\n        IndexHandler\n            .Setup(x => x.GetIndexesNamesAsync<TestDocument, Guid>(It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new List<string> { indexName });\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocument>();\n\n        // Assert\n        Assert.NotNull(result);\n        Assert.Contains(result, x => x == indexName);\n        IndexHandler.Verify(x => x.GetIndexesNamesAsync<TestDocument, Guid>(null, CancellationToken.None), Times.Once());\n    }\n\n    [Fact]\n    public async Task WithCancellationToken_ReturnsIndexNames()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n        var indexName = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        IndexHandler\n            .Setup(x => x.GetIndexesNamesAsync<TestDocument, Guid>(It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new List<string> { indexName });\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocument>(token);\n\n        // Assert\n        Assert.NotNull(result);\n        Assert.Contains(result, x => x == indexName);\n        IndexHandler.Verify(x => x.GetIndexesNamesAsync<TestDocument, Guid>(null, token), Times.Once());\n    }\n\n    [Fact]\n    public async Task WithPartitionKey_ReturnsIndexNames()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n        var indexName = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n\n        IndexHandler\n            .Setup(x => x.GetIndexesNamesAsync<TestDocument, Guid>(It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new List<string> { indexName });\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocument>(partitionKey);\n\n        // Assert\n        Assert.NotNull(result);\n        Assert.Contains(result, x => x == indexName);\n        IndexHandler.Verify(x => x.GetIndexesNamesAsync<TestDocument, Guid>(partitionKey, CancellationToken.None), Times.Once());\n    }\n\n    [Fact]\n    public async Task WithPartitionKeyAndCancellationToken_ReturnsIndexNames()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n        var indexName = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        IndexHandler\n            .Setup(x => x.GetIndexesNamesAsync<TestDocument, Guid>(It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new List<string> { indexName });\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocument>(partitionKey, token);\n\n        // Assert\n        Assert.NotNull(result);\n        Assert.Contains(result, x => x == indexName);\n        IndexHandler.Verify(x => x.GetIndexesNamesAsync<TestDocument, Guid>(partitionKey, token), Times.Once());\n    }\n\n    [Fact]\n    public async Task Keyed_WithNoParameters_ReturnsIndexNames()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n        var indexName = Fixture.Create<string>();\n\n        IndexHandler\n            .Setup(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new List<string> { indexName });\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>();\n\n        // Assert\n        Assert.NotNull(result);\n        Assert.Contains(result, x => x == indexName);\n        IndexHandler.Verify(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(null, CancellationToken.None), Times.Once());\n    }\n\n    [Fact]\n    public async Task Keyed_WithCancellationToken_ReturnsIndexNames()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n        var indexName = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        IndexHandler\n            .Setup(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new List<string> { indexName });\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(token);\n\n        // Assert\n        Assert.NotNull(result);\n        Assert.Contains(result, x => x == indexName);\n        IndexHandler.Verify(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(null, token), Times.Once());\n    }\n\n    [Fact]\n    public async Task Keyed_WithPartitionKey_ReturnsIndexNames()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n        var indexName = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n\n        IndexHandler\n            .Setup(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new List<string> { indexName });\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(partitionKey);\n\n        // Assert\n        Assert.NotNull(result);\n        Assert.Contains(result, x => x == indexName);\n        IndexHandler.Verify(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(partitionKey, CancellationToken.None), Times.Once());\n    }\n\n    [Fact]\n    public async Task Keyed_WithPartitionKeyAndCancellationToken_ReturnsIndexNames()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n        var indexName = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        IndexHandler\n            .Setup(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new List<string> { indexName });\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(partitionKey, token);\n\n        // Assert\n        Assert.NotNull(result);\n        Assert.Contains(result, x => x == indexName);\n        IndexHandler.Verify(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(partitionKey, token), Times.Once());\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/UpdateTests/UpdateManyAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.UpdateTests;\n\npublic class UpdateManyAsyncTests : TestMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, string>> fieldExpression = x => x.SomeContent;\n    private readonly FilterDefinition<TestDocument> filterDefinition = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n    private readonly Expression<Func<TestDocument, bool>> filterExpression = x => x.SomeContent == \"SomeContent\";\n    private readonly UpdateDefinition<TestDocument> updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, \"Updated\");\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, updateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid>(\n                filterExpression,\n                updateDefinition,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndUpdateDefinitionAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, updateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid>(\n                filterExpression,\n                updateDefinition,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndUpdateDefinitionAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, updateDefinition, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid>(\n                filterExpression,\n                updateDefinition,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndUpdateDefinitionAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, updateDefinition, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid>(\n                filterExpression,\n                updateDefinition,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, updateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid>(\n                filterDefinition,\n                updateDefinition,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndUpdateDefinitionCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, updateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid>(\n                filterDefinition,\n                updateDefinition,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndUpdateDefinitionAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, updateDefinition, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid>(\n                filterDefinition,\n                updateDefinition,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndUpdateDefinitionAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocument, Guid>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, updateDefinition, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocument, Guid>(\n                filterDefinition,\n                updateDefinition,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    #region Keyed\n\n    private readonly UpdateDefinition<TestDocumentWithKey<int>> keyedUpdateDefinition =\n        Builders<TestDocumentWithKey<int>>.Update.Set(x => x.SomeContent, \"Updated\");\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, string>> keyedFieldExpression = x => x.SomeContent;\n    private readonly FilterDefinition<TestDocumentWithKey<int>> keyedFilterDefinition = Builders<TestDocumentWithKey<int>>.Filter.Eq(x => x.Id, 1);\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilterExpression = x => x.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public async Task Keyed_WithFilterDefinitionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterDefinitionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterExpressionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterExpressionAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int>(keyedFilterExpression, keyedUpdateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                keyedFilterExpression,\n                keyedUpdateDefinition,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterExpressionAndUpdateDefinitionAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int>(keyedFilterExpression, keyedUpdateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                keyedFilterExpression,\n                keyedUpdateDefinition,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterExpressionAndUpdateDefinitionAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int>(keyedFilterExpression, keyedUpdateDefinition, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                keyedFilterExpression,\n                keyedUpdateDefinition,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterExpressionAndUpdateDefinitionAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int>(keyedFilterExpression, keyedUpdateDefinition, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                keyedFilterExpression,\n                keyedUpdateDefinition,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterDefinitionAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int>(keyedFilterDefinition, keyedUpdateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                keyedFilterDefinition,\n                keyedUpdateDefinition,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterDefinitionAndUpdateDefinitionCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int>(keyedFilterDefinition, keyedUpdateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                keyedFilterDefinition,\n                keyedUpdateDefinition,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterDefinitionAndUpdateDefinitionAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int>(keyedFilterDefinition, keyedUpdateDefinition, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                keyedFilterDefinition,\n                keyedUpdateDefinition,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterDefinitionAndUpdateDefinitionAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocumentWithKey<int>, int>(keyedFilterDefinition, keyedUpdateDefinition, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                keyedFilterDefinition,\n                keyedUpdateDefinition,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/UpdateTests/UpdateManyTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.UpdateTests;\n\npublic class UpdateManyTests : TestMongoRepositoryContext\n{\n\n    private readonly Expression<Func<TestDocument, string>> fieldExpression = x => x.SomeContent;\n    private readonly FilterDefinition<TestDocument> filterDefinition = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n    private readonly Expression<Func<TestDocument, bool>> filterExpression = x => x.SomeContent == \"SomeContent\";\n    private readonly UpdateDefinition<TestDocument> updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, \"Updated\");\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, updateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid>(\n                filterExpression,\n                updateDefinition,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndUpdateDefinitionAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, updateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid>(\n                filterExpression,\n                updateDefinition,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndUpdateDefinitionAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, updateDefinition, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid>(\n                filterExpression,\n                updateDefinition,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndUpdateDefinitionAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, updateDefinition, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid>(\n                filterExpression,\n                updateDefinition,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, updateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid>(\n                filterDefinition,\n                updateDefinition,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndUpdateDefinitionCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, updateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid>(\n                filterDefinition,\n                updateDefinition,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndUpdateDefinitionAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, updateDefinition, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid>(\n                filterDefinition,\n                updateDefinition,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndUpdateDefinitionAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocument, Guid>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, updateDefinition, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocument, Guid>(\n                filterDefinition,\n                updateDefinition,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, string>> keyedFieldExpression = x => x.SomeContent;\n    private readonly FilterDefinition<TestDocumentWithKey<int>> keyedFilterDefinition = Builders<TestDocumentWithKey<int>>.Filter.Eq(x => x.Id, 1);\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilterExpression = x => x.SomeContent == \"SomeContent\";\n    private readonly UpdateDefinition<TestDocumentWithKey<int>> keyedUpdateDefinition = Builders<TestDocumentWithKey<int>>.Update.Set(x => x.SomeContent, \"Updated\");\n\n    [Fact]\n    public void Keyed_WithFilterDefinitionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterDefinitionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterExpressionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterExpressionAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int>(keyedFilterExpression, keyedUpdateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                keyedFilterExpression,\n                keyedUpdateDefinition,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterExpressionAndUpdateDefinitionAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int>(keyedFilterExpression, keyedUpdateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                keyedFilterExpression,\n                keyedUpdateDefinition,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterExpressionAndUpdateDefinitionAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int>(keyedFilterExpression, keyedUpdateDefinition, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                keyedFilterExpression,\n                keyedUpdateDefinition,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterExpressionAndUpdateDefinitionAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int>(keyedFilterExpression, keyedUpdateDefinition, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                keyedFilterExpression,\n                keyedUpdateDefinition,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterDefinitionAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int>(keyedFilterDefinition, keyedUpdateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                keyedFilterDefinition,\n                keyedUpdateDefinition,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterDefinitionAndUpdateDefinitionCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int>(keyedFilterDefinition, keyedUpdateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                keyedFilterDefinition,\n                keyedUpdateDefinition,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterDefinitionAndUpdateDefinitionAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int>(keyedFilterDefinition, keyedUpdateDefinition, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                keyedFilterDefinition,\n                keyedUpdateDefinition,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterDefinitionAndUpdateDefinitionAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocumentWithKey<int>, int>(keyedFilterDefinition, keyedUpdateDefinition, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                keyedFilterDefinition,\n                keyedUpdateDefinition,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/UpdateTests/UpdateOneAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.UpdateTests;\n\npublic class UpdateOneAsyncTests : TestMongoRepositoryContext\n{\n    private readonly UpdateDefinition<TestDocument> updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, \"Updated\");\n    private readonly Expression<Func<TestDocument, string>> fieldExpression = x => x.SomeContent;\n    private readonly FilterDefinition<TestDocument> filterDefinition = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n    private readonly Expression<Func<TestDocument, bool>> filterExpression = x => x.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public async Task WithDocument_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOneAsync<TestDocument, Guid>(It.IsAny<TestDocument>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(document);\n\n        // Assert\n        Updater.Verify(x => x.UpdateOneAsync<TestDocument, Guid>(document, CancellationToken.None), Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithDocumentAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOneAsync<TestDocument, Guid>(It.IsAny<TestDocument>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(document, token);\n\n        // Assert\n        Updater.Verify(x => x.UpdateOneAsync<TestDocument, Guid>(document, token), Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithDocumentAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocument, Guid>(\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(document, updateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocument, Guid>(\n                document,\n                updateDefinition,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithDocumentAndUpdateDefinitionAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocument, Guid>(\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(document, updateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocument, Guid>(\n                document,\n                updateDefinition,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithDocumentAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(document, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                document,\n                fieldExpression,\n                value,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithDocumentAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(document, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                document,\n                fieldExpression,\n                value,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterDefinition, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterDefinition, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterDefinition, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterDefinition, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterExpression, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterExpression, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterExpression, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterExpression, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    #region Keyed\n\n    private readonly UpdateDefinition<TestDocumentWithKey<int>> keyedUpdateDefinition = Builders<TestDocumentWithKey<int>>.Update.Set(x => x.SomeContent, \"Updated\");\n    private readonly Expression<Func<TestDocumentWithKey<int>, string>> keyedFieldExpression = x => x.SomeContent;\n    private readonly FilterDefinition<TestDocumentWithKey<int>> keyedFilterDefinition = Builders<TestDocumentWithKey<int>>.Filter.Eq(x => x.Id, 1);\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilterExpression = x => x.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public async Task Keyed_WithDocument_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<TestDocumentWithKey<int>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int>(document);\n\n        // Assert\n        Updater.Verify(x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(document, CancellationToken.None), Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithDocumentAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<TestDocumentWithKey<int>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int>(document, token);\n\n        // Assert\n        Updater.Verify(x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(document, token), Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithDocumentAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int>(document, keyedUpdateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(\n                document,\n                keyedUpdateDefinition,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithDocumentAndUpdateDefinitionAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int>(document, keyedUpdateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(\n                document,\n                keyedUpdateDefinition,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithDocumentAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(document, keyedFieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                document,\n                keyedFieldExpression,\n                value,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithDocumentAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(document, keyedFieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                document,\n                keyedFieldExpression,\n                value,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterDefinitionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterDefinitionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterExpressionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value);\n\n        // Assert\n        var expectedFilter = Builders<TestDocumentWithKey<int>>.Filter.Where(keyedFilterExpression);\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                It.Is<FilterDefinition<TestDocumentWithKey<int>>>(y => y.EquivalentTo(expectedFilter)),\n                keyedFieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value, token);\n\n        // Assert\n        var expectedFilter = Builders<TestDocumentWithKey<int>>.Filter.Where(keyedFilterExpression);\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                It.Is<FilterDefinition<TestDocumentWithKey<int>>>(y => y.EquivalentTo(expectedFilter)),\n                keyedFieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value, partitionKey);\n\n        // Assert\n        var expectedFilter = Builders<TestDocumentWithKey<int>>.Filter.Where(keyedFilterExpression);\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                It.Is<FilterDefinition<TestDocumentWithKey<int>>>(y => y.EquivalentTo(expectedFilter)),\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value, partitionKey, token);\n\n        // Assert\n        var expectedFilter = Builders<TestDocumentWithKey<int>>.Filter.Where(keyedFilterExpression);\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                It.Is<FilterDefinition<TestDocumentWithKey<int>>>(y => y.EquivalentTo(expectedFilter)),\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    #endregion\n\n    #region ClientSession\n\n    [Fact]\n    public async Task Keyed_WithClientSessionHandlerAndDocument_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(\n                It.IsAny<IClientSessionHandle>(),\n                It.IsAny<TestDocumentWithKey<int>>(),\n                It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int>(session, document);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(\n            session,\n            document,\n            CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithClientSessionHandlerAndDocumentAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(\n                It.IsAny<IClientSessionHandle>(),\n                It.IsAny<TestDocumentWithKey<int>>(),\n                It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int>(session, document, token);\n\n        // Assert\n        Updater.Verify(x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(session, document, token), Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithClientSessionHandlerAndDocumentAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int>(session, document, keyedUpdateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(\n                session,\n                document,\n                keyedUpdateDefinition,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithClientSessionHandlerAndDocumentAndUpdateDefinitionAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int>(session, document, keyedUpdateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(\n                session,\n                document,\n                keyedUpdateDefinition,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithClientSessionHandlerAndDocumentAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(session, document, keyedFieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                session,\n                document,\n                keyedFieldExpression,\n                value,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithClientSessionHandlerAndDocumentAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(session, document, keyedFieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                session,\n                document,\n                keyedFieldExpression,\n                value,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithClientSessionHandlerAndFilterDefinitionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(session, keyedFilterDefinition, keyedFieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                session,\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithClientSessionHandlerAndFilterDefinitionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(session, keyedFilterDefinition, keyedFieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                session,\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithClientSessionHandlerAndFilterDefinitionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(session, keyedFilterDefinition, keyedFieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                session,\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithClientSessionHandlerAndFilterDefinitionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(session, keyedFilterDefinition, keyedFieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                session,\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithClientSessionHandlerAndFilterExpressionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(session, keyedFilterExpression, keyedFieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                session,\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithClientSessionHandlerAndFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(session, keyedFilterExpression, keyedFieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                session,\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithClientSessionHandlerAndFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(session, keyedFilterExpression, keyedFieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                session,\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task Keyed_WithClientSessionHandlerAndFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(session, keyedFilterExpression, keyedFieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                session,\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/BaseMongoRepositoryTests/UpdateTests/UpdateOneTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.BaseMongoRepositoryTests.UpdateTests;\n\npublic class UpdateOneTests : TestMongoRepositoryContext\n{\n    private readonly UpdateDefinition<TestDocument> updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, \"Updated\");\n    private readonly Expression<Func<TestDocument, string>> fieldExpression = x => x.SomeContent;\n    private readonly FilterDefinition<TestDocument> filterDefinition = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n    private readonly Expression<Func<TestDocument, bool>> filterExpression = x => x.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public void WithDocument_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOne<TestDocument, Guid>(It.IsAny<TestDocument>(), It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(document);\n\n        // Assert\n        Updater.Verify(x => x.UpdateOne<TestDocument, Guid>(document, CancellationToken.None), Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithDocumentAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOne<TestDocument, Guid>(It.IsAny<TestDocument>(), It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(document, token);\n\n        // Assert\n        Updater.Verify(x => x.UpdateOne<TestDocument, Guid>(document, token), Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithDocumentAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocument, Guid>(\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(document, updateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocument, Guid>(\n                document,\n                updateDefinition,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithDocumentAndUpdateDefinitionAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocument, Guid>(\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(document, updateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocument, Guid>(\n                document,\n                updateDefinition,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithDocumentAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocument, Guid, string>(\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(document, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocument, Guid, string>(\n                document,\n                fieldExpression,\n                value,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithDocumentAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocument, Guid, string>(\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(document, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocument, Guid, string>(\n                document,\n                fieldExpression,\n                value,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterDefinition, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterDefinition, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterDefinition, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocument, Guid, string>(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterDefinition, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocument, Guid, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterExpression, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterExpression, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterExpression, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocument, Guid, string>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterExpression, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocument, Guid, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    #region Keyed\n\n    private readonly UpdateDefinition<TestDocumentWithKey<int>> keyedUpdateDefinition = Builders<TestDocumentWithKey<int>>.Update.Set(x => x.SomeContent, \"Updated\");\n    private readonly Expression<Func<TestDocumentWithKey<int>, string>> keyedFieldExpression = x => x.SomeContent;\n    private readonly FilterDefinition<TestDocumentWithKey<int>> keyedFilterDefinition = Builders<TestDocumentWithKey<int>>.Filter.Eq(x => x.Id, 1);\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilterExpression = x => x.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public void Keyed_WithDocument_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOne<TestDocumentWithKey<int>, int>(It.IsAny<TestDocumentWithKey<int>>(), It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int>(document);\n\n        // Assert\n        Updater.Verify(x => x.UpdateOne<TestDocumentWithKey<int>, int>(document, CancellationToken.None), Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithDocumentAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOne<TestDocumentWithKey<int>, int>(It.IsAny<TestDocumentWithKey<int>>(), It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int>(document, token);\n\n        // Assert\n        Updater.Verify(x => x.UpdateOne<TestDocumentWithKey<int>, int>(document, token), Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithDocumentAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int>(document, keyedUpdateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int>(\n                document,\n                keyedUpdateDefinition,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithDocumentAndUpdateDefinitionAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int>(document, keyedUpdateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int>(\n                document,\n                keyedUpdateDefinition,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithDocumentAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(document, keyedFieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                document,\n                keyedFieldExpression,\n                value,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithDocumentAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(document, keyedFieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                document,\n                keyedFieldExpression,\n                value,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithFilterDefinitionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithFilterDefinitionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(keyedFilterDefinition, keyedFieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithFilterExpressionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(keyedFilterExpression, keyedFieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                keyedFilterExpression,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    #endregion\n\n    #region client session\n\n    [Fact]\n    public void Keyed_WithClientSessionHandlerAndDocument_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var session = new Mock<IClientSessionHandle>().Object;\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOne<TestDocumentWithKey<int>, int>(\n                It.IsAny<IClientSessionHandle>(),\n                It.IsAny<TestDocumentWithKey<int>>(),\n                It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int>(session, document);\n\n        // Assert\n        Updater.Verify(x => x.UpdateOne<TestDocumentWithKey<int>, int>(\n            session,\n            document,\n            CancellationToken.None), Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithClientSessionHandlerAndDocumentAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        var session = new Mock<IClientSessionHandle>().Object;\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOne<TestDocumentWithKey<int>, int>(\n                It.IsAny<IClientSessionHandle>(),\n                It.IsAny<TestDocumentWithKey<int>>(),\n                It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int>(session, document, token);\n\n        // Assert\n        Updater.Verify(x => x.UpdateOne<TestDocumentWithKey<int>, int>(session, document, token), Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithClientSessionHandlerAndDocumentAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int>(session, document, keyedUpdateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int>(\n                session,\n                document,\n                keyedUpdateDefinition,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithClientSessionHandlerAndDocumentAndUpdateDefinitionAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int>(session, document, keyedUpdateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int>(\n                session,\n                document,\n                keyedUpdateDefinition,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithClientSessionHandlerAndDocumentAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(session, document, keyedFieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                session,\n                document,\n                keyedFieldExpression,\n                value,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithClientSessionHandlerAndDocumentAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(session, document, keyedFieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                session,\n                document,\n                keyedFieldExpression,\n                value,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithClientSessionHandlerFilterDefinitionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(session, keyedFilterDefinition, keyedFieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                session,\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithClientSessionHandlerFilterDefinitionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(session, keyedFilterDefinition, keyedFieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                session,\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithClientSessionHandlerFilterDefinitionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(session, keyedFilterDefinition, keyedFieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                session,\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithClientSessionHandlerFilterDefinitionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(session, keyedFilterDefinition, keyedFieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                session,\n                keyedFilterDefinition,\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithClientSessionHandlerFilterExpressionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(session, keyedFilterExpression, keyedFieldExpression, value);\n\n        // Assert\n        var expectedFilterDefinition = new ExpressionFilterDefinition<TestDocumentWithKey<int>>(keyedFilterExpression);\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                session,\n                It.Is<FilterDefinition<TestDocumentWithKey<int>>>(y => y.EquivalentTo(expectedFilterDefinition)),\n                keyedFieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithClientSessionHandlerFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(session, keyedFilterExpression, keyedFieldExpression, value, token);\n\n        // Assert\n        var expectedFilterDefinition = new ExpressionFilterDefinition<TestDocumentWithKey<int>>(keyedFilterExpression);\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                session,\n                It.Is<FilterDefinition<TestDocumentWithKey<int>>>(y => y.EquivalentTo(expectedFilterDefinition)),\n                keyedFieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithClientSessionHandlerFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(session, keyedFilterExpression, keyedFieldExpression, value, partitionKey);\n\n        // Assert\n        var expectedFilterDefinition = new ExpressionFilterDefinition<TestDocumentWithKey<int>>(keyedFilterExpression);\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                session,\n                It.Is<FilterDefinition<TestDocumentWithKey<int>>>(y => y.EquivalentTo(expectedFilterDefinition)),\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void Keyed_WithClientSessionHandlerFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var session = new Mock<IClientSessionHandle>().Object;\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocumentWithKey<int>, int, string>(session, keyedFilterExpression, keyedFieldExpression, value, partitionKey, token);\n\n        // Assert\n        var expectedFilterDefinition = new ExpressionFilterDefinition<TestDocumentWithKey<int>>(keyedFilterExpression);\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                session,\n                It.Is<FilterDefinition<TestDocumentWithKey<int>>>(y => y.EquivalentTo(expectedFilterDefinition)),\n                keyedFieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/CoreUnitTests.csproj",
    "content": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n    <PropertyGroup>\n        <TargetFramework>net8.0</TargetFramework>\n        <Nullable>warnings</Nullable>\n        <ImplicitUsings>enable</ImplicitUsings>\n        <IsPackable>false</IsPackable>\n        <EnableNETAnalyzers>true</EnableNETAnalyzers>\n        <AnalysisLevel>latest</AnalysisLevel>\n    </PropertyGroup>\n\n    <ItemGroup>\n        <PackageReference Include=\"AutoFixture\" Version=\"4.18.1\" />\n        <PackageReference Include=\"AutoFixture.AutoMoq\" Version=\"4.18.1\" />\n        <PackageReference Include=\"Fare\" Version=\"2.2.1\" />\n        <PackageReference Include=\"FluentAssertions\" Version=\"6.12.2\" />\n        <PackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"17.*\" />\n        <PackageReference Include=\"Moq\" Version=\"4.20.72\" />\n        <PackageReference Include=\"System.ComponentModel.Annotations\" Version=\"5.0.0\" />\n        <PackageReference Include=\"xunit\" Version=\"2.9.2\" />\n        <PackageReference Include=\"xunit.runner.console\" Version=\"2.9.2\">\n            <PrivateAssets>all</PrivateAssets>\n            <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>\n        </PackageReference>\n        <PackageReference Include=\"xunit.runner.visualstudio\" Version=\"2.8.2\">\n            <PrivateAssets>all</PrivateAssets>\n            <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n        </PackageReference>\n        <PackageReference Include=\"coverlet.collector\" Version=\"6.0.2\">\n            <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n            <PrivateAssets>all</PrivateAssets>\n        </PackageReference>\n    </ItemGroup>\n\n    <ItemGroup>\n      <ProjectReference Include=\"..\\MongoDbGenericRepository\\MongoDbGenericRepository.csproj\" />\n    </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbCreatorTests/AddManyAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbCreatorTests;\n\npublic class AddManyAsyncTests : GenericTestContext<MongoDbCreator>\n{\n    [Fact]\n    public async Task WithDocuments_AddsMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        await Sut.AddManyAsync<TestDocument, Guid>(documents);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertManyAsync(\n                It.Is<List<TestDocument>>(l => l.All(d => documents.Contains(d))),\n                null,\n                default),\n            Times.Once());\n    }\n\n    [Fact]\n    public async Task WithDocumentsHavingNoId_SetsId()\n    {\n        // Arrange\n        var documents = Fixture\n            .Build<TestDocumentWithKey<string>>()\n            .Without(x => x.Id)\n            .CreateMany()\n            .ToList();\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<TestDocumentWithKey<string>>>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocumentWithKey<string>>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        await Sut.AddManyAsync<TestDocumentWithKey<string>, string>(documents);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertManyAsync(\n                It.Is<List<TestDocumentWithKey<string>>>(l => l.All(d => documents.Contains(d))),\n                null,\n                default),\n            Times.Once());\n\n        documents.Should().AllSatisfy(d => d.Id.Should().NotBeNull());\n    }\n\n    [Fact]\n    public async Task WithPartitionedDocument_AddsMany()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var documents = Fixture.Build<PartitionedTestDocument>()\n            .With(x => x.PartitionKey, partitionKey)\n            .CreateMany()\n            .ToList();\n\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<PartitionedTestDocument>>();\n\n        context\n            .Setup(x => x.GetCollection<PartitionedTestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        await Sut.AddManyAsync<PartitionedTestDocument, Guid>(documents);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertManyAsync(\n                It.Is<List<PartitionedTestDocument>>(l => l.All(d => documents.Contains(d))),\n                null,\n                default),\n            Times.Once());\n\n        context.Verify(x => x.GetCollection<PartitionedTestDocument>(partitionKey), Times.Once());\n    }\n\n    [Fact]\n    public async Task WithDocumentsAndCancellationToken_AddsMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        await Sut.AddManyAsync<TestDocument, Guid>(documents, token);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertManyAsync(\n                It.Is<List<TestDocument>>(l => l.All(d => documents.Contains(d))),\n                null,\n                token),\n            Times.Once());\n    }\n\n    [Fact]\n    public async Task WithPartitionedDocumentAndCancellationToken_AddsOne()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var documents = Fixture.Build<PartitionedTestDocument>()\n            .With(x => x.PartitionKey, partitionKey)\n            .CreateMany()\n            .ToList();\n        var token = new CancellationToken(true);\n\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<PartitionedTestDocument>>();\n\n        context\n            .Setup(x => x.GetCollection<PartitionedTestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        await Sut.AddManyAsync<PartitionedTestDocument, Guid>(documents, token);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertManyAsync(\n                It.Is<List<PartitionedTestDocument>>(l => l.All(d => documents.Contains(d))),\n                null,\n                token),\n            Times.Once());\n\n        context.Verify(x => x.GetCollection<PartitionedTestDocument>(partitionKey), Times.Once());\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbCreatorTests/AddManyTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbCreatorTests;\n\npublic class AddManyTests : GenericTestContext<MongoDbCreator>\n{\n    [Fact]\n    public void WithDocuments_AddsMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        Sut.AddMany<TestDocument, Guid>(documents);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertMany(\n                It.Is<List<TestDocument>>(l => l.All(d => documents.Contains(d))),\n                null,\n                default),\n            Times.Once());\n    }\n\n    [Fact]\n    public void WithDocumentsHavingNoId_SetsId()\n    {\n        // Arrange\n        var documents = Fixture\n            .Build<TestDocumentWithKey<string>>()\n            .Without(x => x.Id)\n            .CreateMany()\n            .ToList();\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<TestDocumentWithKey<string>>>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocumentWithKey<string>>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        Sut.AddMany<TestDocumentWithKey<string>, string>(documents);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertMany(\n                It.Is<List<TestDocumentWithKey<string>>>(l => l.All(d => documents.Contains(d))),\n                null,\n                default),\n            Times.Once());\n\n        documents.Should().AllSatisfy(d => d.Id.Should().NotBeNull());\n    }\n\n    [Fact]\n    public void WithPartitionedDocument_AddsMany()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var documents = Fixture.Build<PartitionedTestDocument>()\n            .With(x => x.PartitionKey, partitionKey)\n            .CreateMany()\n            .ToList();\n\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<PartitionedTestDocument>>();\n\n        context\n            .Setup(x => x.GetCollection<PartitionedTestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        Sut.AddMany<PartitionedTestDocument, Guid>(documents);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertMany(\n                It.Is<List<PartitionedTestDocument>>(l => l.All(d => documents.Contains(d))),\n                null,\n                default),\n            Times.Once());\n\n        context.Verify(x => x.GetCollection<PartitionedTestDocument>(partitionKey), Times.Once());\n    }\n\n    [Fact]\n    public void WithDocumentsAndCancellationToken_AddsMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        Sut.AddMany<TestDocument, Guid>(documents, token);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertMany(\n                It.Is<List<TestDocument>>(l => l.All(d => documents.Contains(d))),\n                null,\n                token),\n            Times.Once());\n    }\n\n    [Fact]\n    public void WithPartitionedDocumentAndCancellationToken_AddsOne()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var documents = Fixture.Build<PartitionedTestDocument>()\n            .With(x => x.PartitionKey, partitionKey)\n            .CreateMany()\n            .ToList();\n        var token = new CancellationToken(true);\n\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<PartitionedTestDocument>>();\n\n        context\n            .Setup(x => x.GetCollection<PartitionedTestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        Sut.AddMany<PartitionedTestDocument, Guid>(documents, token);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertMany(\n                It.Is<List<PartitionedTestDocument>>(l => l.All(d => documents.Contains(d))),\n                null,\n                token),\n            Times.Once());\n\n        context.Verify(x => x.GetCollection<PartitionedTestDocument>(partitionKey), Times.Once());\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbCreatorTests/AddOneAsyncTests.cs",
    "content": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbCreatorTests;\n\npublic class AddOneAsyncTests : GenericTestContext<MongoDbCreator>\n{\n    [Fact]\n    public async Task WithDocument_AddsOne()\n    {\n        // Arrange\n        var document = new TestDocument();\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        await Sut.AddOneAsync<TestDocument, Guid>(document);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertOneAsync(\n                It.Is<TestDocument>(d => d == document),\n                null,\n                default),\n            Times.Once());\n    }\n\n    [Fact]\n    public async Task WithDocumentHavingNoId_SetsId()\n    {\n        // Arrange\n        var document = new TestDocumentWithKey<string>();\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<TestDocumentWithKey<string>>>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocumentWithKey<string>>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        await Sut.AddOneAsync<TestDocumentWithKey<string>, string>(document);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertOneAsync(\n                It.Is<TestDocumentWithKey<string>>(d => d == document),\n                null,\n                default),\n            Times.Once());\n\n        document.Id.Should().NotBeNull();\n    }\n\n    [Fact]\n    public async Task WithPartitionedDocument_AddsOne()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var document = Fixture.Build<PartitionedTestDocument>()\n            .With(x => x.PartitionKey, partitionKey)\n            .Create();\n\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<PartitionedTestDocument>>();\n\n        context\n            .Setup(x => x.GetCollection<PartitionedTestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        await Sut.AddOneAsync<PartitionedTestDocument, Guid>(document);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertOneAsync(\n                It.Is<PartitionedTestDocument>(d => d == document),\n                null,\n                default),\n            Times.Once());\n\n        context.Verify(x => x.GetCollection<PartitionedTestDocument>(partitionKey), Times.Once());\n    }\n\n    [Fact]\n    public async Task WithDocumentAndCancellationToken_AddsOne()\n    {\n        // Arrange\n        var document = new TestDocument();\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        await Sut.AddOneAsync<TestDocument, Guid>(document, token);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertOneAsync(\n                It.Is<TestDocument>(d => d == document),\n                null,\n                token),\n            Times.Once());\n    }\n\n    [Fact]\n    public async Task WithPartitionedDocumentAndCancellationToken_AddsOne()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var document = Fixture.Build<PartitionedTestDocument>()\n            .With(x => x.PartitionKey, partitionKey)\n            .Create();\n        var token = new CancellationToken(true);\n\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<PartitionedTestDocument>>();\n\n        context\n            .Setup(x => x.GetCollection<PartitionedTestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        await Sut.AddOneAsync<PartitionedTestDocument, Guid>(document, token);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertOneAsync(\n                It.Is<PartitionedTestDocument>(d => d == document),\n                null,\n                token),\n            Times.Once());\n\n        context.Verify(x => x.GetCollection<PartitionedTestDocument>(partitionKey), Times.Once());\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbCreatorTests/AddOneTests.cs",
    "content": "using System;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbCreatorTests;\n\npublic class AddOneTests : GenericTestContext<MongoDbCreator>\n{\n    [Fact]\n    public void WithDocument_AddsOne()\n    {\n        // Arrange\n        var document = new TestDocument();\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        Sut.AddOne<TestDocument, Guid>(document);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertOne(\n                It.Is<TestDocument>(d => d == document),\n                null,\n                default),\n            Times.Once());\n    }\n\n    [Fact]\n    public void WithDocumentHavingNoId_SetsId()\n    {\n        // Arrange\n        var document = new TestDocumentWithKey<string>();\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<TestDocumentWithKey<string>>>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocumentWithKey<string>>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        Sut.AddOne<TestDocumentWithKey<string>, string>(document);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertOne(\n                It.Is<TestDocumentWithKey<string>>(d => d == document),\n                null,\n                default),\n            Times.Once());\n\n        document.Id.Should().NotBeNull();\n    }\n\n    [Fact]\n    public void WithPartitionedDocument_AddsOne()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var document = Fixture.Build<PartitionedTestDocument>()\n            .With(x => x.PartitionKey, partitionKey)\n            .Create();\n\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<PartitionedTestDocument>>();\n\n        context\n            .Setup(x => x.GetCollection<PartitionedTestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        Sut.AddOne<PartitionedTestDocument, Guid>(document);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertOne(\n                It.Is<PartitionedTestDocument>(d => d == document),\n                null,\n                default),\n            Times.Once());\n\n        context.Verify(x => x.GetCollection<PartitionedTestDocument>(partitionKey), Times.Once());\n    }\n\n    [Fact]\n    public void WithDocumentAndCancellationToken_AddsOne()\n    {\n        // Arrange\n        var document = new TestDocument();\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        Sut.AddOne<TestDocument, Guid>(document, token);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertOne(\n                It.Is<TestDocument>(d => d == document),\n                null,\n                token),\n            Times.Once());\n    }\n\n    [Fact]\n    public void WithPartitionedDocumentAndCancellationToken_AddsOne()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var document = Fixture.Build<PartitionedTestDocument>()\n            .With(x => x.PartitionKey, partitionKey)\n            .Create();\n        var token = new CancellationToken(true);\n\n        var context = MockOf<IMongoDbContext>();\n        var collection = MockOf<IMongoCollection<PartitionedTestDocument>>();\n\n        context\n            .Setup(x => x.GetCollection<PartitionedTestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        Sut.AddOne<PartitionedTestDocument, Guid>(document, token);\n\n        // Assert\n        collection.Verify(\n            x => x.InsertOne(\n                It.Is<PartitionedTestDocument>(d => d == document),\n                null,\n                token),\n            Times.Once());\n\n        context.Verify(x => x.GetCollection<PartitionedTestDocument>(partitionKey), Times.Once());\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbEraserTests/DeleteManyAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbEraserTests;\n\npublic class DeleteManyAsyncTests : GenericTestContext<MongoDbEraser>\n{\n    [Fact]\n    public async Task WithEmptyDocuments_DeletesNothing()\n    {\n        // Arrange\n        var documents = new List<TestDocument>(0);\n        var token = new CancellationToken(true);\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        // Act\n        var result = await Sut.DeleteManyAsync<TestDocument, Guid>(documents, token);\n\n        // Assert\n        result.Should().Be(0);\n\n        var idsToDelete = documents.Select(e => e.Id).ToArray();\n        Expression<Func<TestDocument, bool>> expectedFilter = x => idsToDelete.Contains(x.Id);\n        collection.Verify(\n            x => x.DeleteManyAsync(\n                It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                token),\n            Times.Never);\n    }\n\n    [Fact]\n    public async Task WithDocumentsAndCancellationToken_DeletesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        collection\n            .Setup(x => x.DeleteManyAsync(It.IsAny<FilterDefinition<TestDocument>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new DeleteResult.Acknowledged(count));\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        // Act\n        var result = await Sut.DeleteManyAsync<TestDocument, Guid>(documents, token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var idsToDelete = documents.Select(e => e.Id).ToArray();\n        Expression<Func<TestDocument, bool>> expectedFilter = x => idsToDelete.Contains(x.Id);\n        collection.Verify(\n            x => x.DeleteManyAsync(\n                It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithPartitionDocumentsAndCancellationToken_DeletesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var documents = Fixture\n            .Build<PartitionedTestDocument>()\n            .With(x => x.PartitionKey, partitionKey)\n            .CreateMany()\n            .ToList();\n        var token = new CancellationToken(true);\n\n        var collection = MockOf<IMongoCollection<PartitionedTestDocument>>();\n        collection\n            .Setup(x => x.DeleteManyAsync(It.IsAny<FilterDefinition<PartitionedTestDocument>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new DeleteResult.Acknowledged(count));\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<PartitionedTestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        var result = await Sut.DeleteManyAsync<PartitionedTestDocument, Guid>(documents, token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var idsToDelete = documents.Select(e => e.Id).ToArray();\n        Expression<Func<PartitionedTestDocument, bool>> expectedFilter = x => idsToDelete.Contains(x.Id);\n        collection.Verify(\n            x => x.DeleteManyAsync(\n                It.Is<FilterDefinition<PartitionedTestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                token),\n            Times.Once);\n\n        dbContext.Verify(x => x.GetCollection<PartitionedTestDocument>(partitionKey), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKeyAndCancellationToken_DeletesOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var id = Fixture.Create<Guid>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        collection\n            .Setup(x => x.DeleteManyAsync(It.IsAny<FilterDefinition<TestDocument>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new DeleteResult.Acknowledged(count));\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        Expression<Func<TestDocument, bool>> filter = d => d.Id == id;\n\n        // Act\n        var result = await Sut.DeleteManyAsync<TestDocument, Guid>(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        collection.Verify(\n            x => x.DeleteManyAsync(\n                It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                token),\n            Times.Once);\n\n        dbContext.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbEraserTests/DeleteManyTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbEraserTests;\n\npublic class DeleteManyTests : GenericTestContext<MongoDbEraser>\n{\n    [Fact]\n    public void WithEmptyDocuments_DeletesNothing()\n    {\n        // Arrange\n        var documents = new List<TestDocument>(0);\n        var token = new CancellationToken(true);\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        // Act\n        var result = Sut.DeleteMany<TestDocument, Guid>(documents, token);\n\n        // Assert\n        result.Should().Be(0);\n\n        var idsToDelete = documents.Select(e => e.Id).ToArray();\n        Expression<Func<TestDocument, bool>> expectedFilter = x => idsToDelete.Contains(x.Id);\n        collection.Verify(\n            x => x.DeleteMany(\n                It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                token),\n            Times.Never);\n    }\n\n    [Fact]\n    public void WithDocumentsAndCancellationToken_DeletesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        collection\n            .Setup(x => x.DeleteMany(It.IsAny<FilterDefinition<TestDocument>>(), It.IsAny<CancellationToken>()))\n            .Returns(new DeleteResult.Acknowledged(count));\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        // Act\n        var result = Sut.DeleteMany<TestDocument, Guid>(documents, token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var idsToDelete = documents.Select(e => e.Id).ToArray();\n        Expression<Func<TestDocument, bool>> expectedFilter = x => idsToDelete.Contains(x.Id);\n        collection.Verify(\n            x => x.DeleteMany(\n                It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithPartitionDocumentsAndCancellationToken_DeletesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var documents = Fixture\n            .Build<PartitionedTestDocument>()\n            .With(x => x.PartitionKey, partitionKey)\n            .CreateMany()\n            .ToList();\n        var token = new CancellationToken(true);\n\n        var collection = MockOf<IMongoCollection<PartitionedTestDocument>>();\n        collection\n            .Setup(x => x.DeleteMany(It.IsAny<FilterDefinition<PartitionedTestDocument>>(), It.IsAny<CancellationToken>()))\n            .Returns(new DeleteResult.Acknowledged(count));\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<PartitionedTestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        // Act\n        var result = Sut.DeleteMany<PartitionedTestDocument, Guid>(documents, token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var idsToDelete = documents.Select(e => e.Id).ToArray();\n        Expression<Func<PartitionedTestDocument, bool>> expectedFilter = x => idsToDelete.Contains(x.Id);\n        collection.Verify(\n            x => x.DeleteMany(\n                It.Is<FilterDefinition<PartitionedTestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                token),\n            Times.Once);\n\n        dbContext.Verify(x => x.GetCollection<PartitionedTestDocument>(partitionKey), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKeyAndCancellationToken_DeletesOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var id = Fixture.Create<Guid>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        collection\n            .Setup(x => x.DeleteMany(It.IsAny<FilterDefinition<TestDocument>>(), It.IsAny<CancellationToken>()))\n            .Returns(new DeleteResult.Acknowledged(count));\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        Expression<Func<TestDocument, bool>> filter = d => d.Id == id;\n\n        // Act\n        var result = Sut.DeleteMany<TestDocument, Guid>(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        collection.Verify(\n            x => x.DeleteMany(\n                It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                token),\n            Times.Once);\n\n        dbContext.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbEraserTests/DeleteOneAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbEraserTests;\n\npublic class DeleteOneAsyncTests : GenericTestContext<MongoDbEraser>\n{\n    [Fact]\n    public async Task WithDocumentAndCancellationToken_DeletesOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        collection\n            .Setup(x => x.DeleteOneAsync(It.IsAny<FilterDefinition<TestDocument>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new DeleteResult.Acknowledged(count));\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        // Act\n        var result = await Sut.DeleteOneAsync<TestDocument, Guid>(document, token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        collection.Verify(\n            x => x.DeleteOneAsync(\n                It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                token),\n            Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKeyAndCancellationToken_DeletesOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        collection\n            .Setup(x => x.DeleteOneAsync(It.IsAny<FilterDefinition<TestDocument>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new DeleteResult.Acknowledged(count));\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        Expression<Func<TestDocument, bool>> filter = d => d.Id == document.Id;\n\n        // Act\n        var result = await Sut.DeleteOneAsync<TestDocument, Guid>(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        collection.Verify(\n            x => x.DeleteOneAsync(\n                It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                token),\n            Times.Once());\n\n        dbContext.Verify(x => x.GetCollection<TestDocument>(partitionKey));\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbEraserTests/DeleteOneTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbEraserTests;\n\npublic class DeleteOneTests : GenericTestContext<MongoDbEraser>\n{\n    [Fact]\n    public void WithDocumentAndCancellationToken_DeletesOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        collection\n            .Setup(x => x.DeleteOne(It.IsAny<FilterDefinition<TestDocument>>(), It.IsAny<CancellationToken>()))\n            .Returns(new DeleteResult.Acknowledged(count));\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        // Act\n        var result = Sut.DeleteOne<TestDocument, Guid>(document, token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        collection.Verify(\n            x => x.DeleteOne(\n                It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                token),\n            Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKeyAndCancellationToken_DeletesOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        collection\n            .Setup(x => x.DeleteOne(It.IsAny<FilterDefinition<TestDocument>>(), It.IsAny<CancellationToken>()))\n            .Returns(new DeleteResult.Acknowledged(count));\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        Expression<Func<TestDocument, bool>> filter = d => d.Id == document.Id;\n\n        // Act\n        var result = Sut.DeleteOne<TestDocument, Guid>(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        collection.Verify(\n            x => x.DeleteOne(\n                It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                token),\n            Times.Once());\n\n        dbContext.Verify(x => x.GetCollection<TestDocument>(partitionKey));\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbIndexHandlerTests/BaseIndexTests.cs",
    "content": "using System.Collections.Generic;\nusing System.Threading;\nusing CoreUnitTests.Infrastructure;\nusing MongoDB.Bson;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing Moq;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbIndexHandlerTests;\n\npublic class BaseIndexTests : GenericTestContext<MongoDbIndexHandler>\n{\n    protected (Mock<IAsyncCursor<BsonDocument>>, Mock<IMongoIndexManager<TDocument>>) SetupIndexes<TDocument>(\n        List<BsonDocument> indexes,\n        Mock<IMongoCollection<TDocument>> collection)\n    {\n        var asyncCursor = MockOf<IAsyncCursor<BsonDocument>>();\n        var moveNextSequence = asyncCursor\n            .SetupSequence(x => x.MoveNextAsync(It.IsAny<CancellationToken>()));\n\n        var currentSequence = asyncCursor\n            .SetupSequence(x => x.Current);\n\n        foreach (var bsonDocument in indexes)\n        {\n            moveNextSequence.ReturnsAsync(true);\n            currentSequence.Returns(new[] {bsonDocument});\n        }\n\n        moveNextSequence.ReturnsAsync(false);\n\n        var indexManager = MockOf<IMongoIndexManager<TDocument>>();\n        indexManager\n            .Setup(x => x.ListAsync(It.IsAny<CancellationToken>()))\n            .ReturnsAsync(asyncCursor.Object);\n\n        collection\n            .SetupGet(x => x.Indexes)\n            .Returns(indexManager.Object);\n\n        return (asyncCursor, indexManager);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbIndexHandlerTests/CreateAscendingIndexAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.Models;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbIndexHandlerTests;\n\npublic class CreateAscendingIndexAsyncTests : BaseIndexTests\n{\n    private readonly Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;\n\n    [Fact]\n    public async Task WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateAscendingIndexAsync<TestDocument, Guid>(fieldExpression);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":1}\")),\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var options = Fixture.Create<IndexCreationOptions>();\n\n        SetupContext(collection);\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateAscendingIndexAsync<TestDocument, Guid>(fieldExpression, options);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":1}\") &&\n                         t.Options.EqualTo(options)),\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var partitionKey = Fixture.Create<string>();\n\n        var context = SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateAscendingIndexAsync<TestDocument, Guid>(fieldExpression, partitionKey: partitionKey);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":1}\") ),\n                null,\n                CancellationToken.None),\n            Times.Once);\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n\n        SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateAscendingIndexAsync<TestDocument, Guid>(fieldExpression, cancellationToken: token);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":1}\") ),\n                null,\n                token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n        var partitionKey = Fixture.Create<string>();\n        var options = Fixture.Create<IndexCreationOptions>();\n\n        var context = SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateAscendingIndexAsync<TestDocument, Guid>(fieldExpression, options, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":1}\") &&\n                         t.Options.EqualTo(options)),\n                null,\n                token),\n            Times.Once);\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n    }\n\n    private Mock<IMongoDbContext> SetupContext(Mock<IMongoCollection<TestDocument>> collection)\n    {\n        var context = MockOf<IMongoDbContext>();\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        return context;\n    }\n\n    private Mock<IMongoIndexManager<TDocument>> SetupIndexManager<TDocument>(Mock<IMongoCollection<TDocument>> collection, string indexName)\n    {\n        var indexManager = MockOf<IMongoIndexManager<TDocument>>();\n        indexManager\n            .Setup(\n                x => x.CreateOneAsync(\n                    It.IsAny<CreateIndexModel<TDocument>>(),\n                    It.IsAny<CreateOneIndexOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(indexName);\n\n        collection\n            .SetupGet(x => x.Indexes)\n            .Returns(indexManager.Object);\n\n        return indexManager;\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbIndexHandlerTests/CreateCombinedTextIndexAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.Models;\nusing Moq;\nusing Xunit;\nusing Xunit.Abstractions;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbIndexHandlerTests;\n\npublic class CreateCombinedTextIndexAsyncTests : BaseIndexTests\n{\n    private readonly ITestOutputHelper testOutputHelper;\n    private readonly List<Expression<Func<TestDocument, object>>> fieldExpressions = new()\n    {\n        t => t.SomeContent2,\n        t => t.GroupingKey\n    };\n\n    public CreateCombinedTextIndexAsyncTests(ITestOutputHelper testOutputHelper)\n        => this.testOutputHelper = testOutputHelper;\n\n    [Fact]\n    public async Task WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateCombinedTextIndexAsync<TestDocument, Guid>(fieldExpressions);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":\\\"text\\\",\\\"GroupingKey\\\":\\\"text\\\"}\", testOutputHelper)),\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var options = Fixture.Create<IndexCreationOptions>();\n\n        SetupContext(collection);\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateCombinedTextIndexAsync<TestDocument, Guid>(fieldExpressions, options);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":\\\"text\\\",\\\"GroupingKey\\\":\\\"text\\\"}\") &&\n                         t.Options.EqualTo(options)),\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var partitionKey = Fixture.Create<string>();\n\n        var context = SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateCombinedTextIndexAsync<TestDocument, Guid>(fieldExpressions, partitionKey: partitionKey);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":\\\"text\\\",\\\"GroupingKey\\\":\\\"text\\\"}\") ),\n                null,\n                CancellationToken.None),\n            Times.Once);\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n\n        SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateCombinedTextIndexAsync<TestDocument, Guid>(fieldExpressions, cancellationToken: token);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":\\\"text\\\",\\\"GroupingKey\\\":\\\"text\\\"}\") ),\n                null,\n                token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n        var partitionKey = Fixture.Create<string>();\n        var options = Fixture.Create<IndexCreationOptions>();\n\n        var context = SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateCombinedTextIndexAsync<TestDocument, Guid>(fieldExpressions, options, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":\\\"text\\\",\\\"GroupingKey\\\":\\\"text\\\"}\") &&\n                         t.Options.EqualTo(options)),\n                null,\n                token),\n            Times.Once);\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n    }\n\n    private Mock<IMongoDbContext> SetupContext(Mock<IMongoCollection<TestDocument>> collection)\n    {\n        var context = MockOf<IMongoDbContext>();\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        return context;\n    }\n\n    private Mock<IMongoIndexManager<TDocument>> SetupIndexManager<TDocument>(Mock<IMongoCollection<TDocument>> collection, string indexName)\n    {\n        var indexManager = MockOf<IMongoIndexManager<TDocument>>();\n        indexManager\n            .Setup(\n                x => x.CreateOneAsync(\n                    It.IsAny<CreateIndexModel<TDocument>>(),\n                    It.IsAny<CreateOneIndexOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(indexName);\n\n        collection\n            .SetupGet(x => x.Indexes)\n            .Returns(indexManager.Object);\n\n        return indexManager;\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbIndexHandlerTests/CreateDescendingIndexAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.Models;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbIndexHandlerTests;\n\npublic class CreateDescendingIndexAsyncTests : BaseIndexTests\n{\n    private readonly Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;\n\n    [Fact]\n    public async Task WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateDescendingIndexAsync<TestDocument, Guid>(fieldExpression);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":-1}\")),\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var options = Fixture.Create<IndexCreationOptions>();\n\n        SetupContext(collection);\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateDescendingIndexAsync<TestDocument, Guid>(fieldExpression, options);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":-1}\") &&\n                         t.Options.EqualTo(options)),\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var partitionKey = Fixture.Create<string>();\n\n        var context = SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateDescendingIndexAsync<TestDocument, Guid>(fieldExpression, partitionKey: partitionKey);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":-1}\") ),\n                null,\n                CancellationToken.None),\n            Times.Once);\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n\n        SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateDescendingIndexAsync<TestDocument, Guid>(fieldExpression, cancellationToken: token);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":-1}\") ),\n                null,\n                token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n        var partitionKey = Fixture.Create<string>();\n        var options = Fixture.Create<IndexCreationOptions>();\n\n        var context = SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateDescendingIndexAsync<TestDocument, Guid>(fieldExpression, options, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":-1}\") &&\n                         t.Options.EqualTo(options)),\n                null,\n                token),\n            Times.Once);\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n    }\n\n    private Mock<IMongoDbContext> SetupContext(Mock<IMongoCollection<TestDocument>> collection)\n    {\n        var context = MockOf<IMongoDbContext>();\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        return context;\n    }\n\n    private Mock<IMongoIndexManager<TDocument>> SetupIndexManager<TDocument>(Mock<IMongoCollection<TDocument>> collection, string indexName)\n    {\n        var indexManager = MockOf<IMongoIndexManager<TDocument>>();\n        indexManager\n            .Setup(\n                x => x.CreateOneAsync(\n                    It.IsAny<CreateIndexModel<TDocument>>(),\n                    It.IsAny<CreateOneIndexOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(indexName);\n\n        collection\n            .SetupGet(x => x.Indexes)\n            .Returns(indexManager.Object);\n\n        return indexManager;\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbIndexHandlerTests/CreateHashedIndexAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.Models;\nusing Moq;\nusing Xunit;\nusing Xunit.Abstractions;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbIndexHandlerTests;\n\npublic class CreateHashedIndexAsyncTests : BaseIndexTests\n{\n    private readonly ITestOutputHelper testOutputHelper;\n    private readonly Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;\n\n    public CreateHashedIndexAsyncTests(ITestOutputHelper testOutputHelper)\n        => this.testOutputHelper = testOutputHelper;\n\n    [Fact]\n    public async Task WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateHashedIndexAsync<TestDocument, Guid>(fieldExpression);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":\\\"hashed\\\"}\", testOutputHelper)),\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var options = Fixture.Create<IndexCreationOptions>();\n\n        SetupContext(collection);\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateHashedIndexAsync<TestDocument, Guid>(fieldExpression, options);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":\\\"hashed\\\"}\") &&\n                         t.Options.EqualTo(options)),\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var partitionKey = Fixture.Create<string>();\n\n        var context = SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateHashedIndexAsync<TestDocument, Guid>(fieldExpression, partitionKey: partitionKey);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":\\\"hashed\\\"}\") ),\n                null,\n                CancellationToken.None),\n            Times.Once);\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n\n        SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateHashedIndexAsync<TestDocument, Guid>(fieldExpression, cancellationToken: token);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":\\\"hashed\\\"}\") ),\n                null,\n                token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n        var partitionKey = Fixture.Create<string>();\n        var options = Fixture.Create<IndexCreationOptions>();\n\n        var context = SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateHashedIndexAsync<TestDocument, Guid>(fieldExpression, options, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":\\\"hashed\\\"}\") &&\n                         t.Options.EqualTo(options)),\n                null,\n                token),\n            Times.Once);\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n    }\n\n    private Mock<IMongoDbContext> SetupContext(Mock<IMongoCollection<TestDocument>> collection)\n    {\n        var context = MockOf<IMongoDbContext>();\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        return context;\n    }\n\n    private Mock<IMongoIndexManager<TDocument>> SetupIndexManager<TDocument>(Mock<IMongoCollection<TDocument>> collection, string indexName)\n    {\n        var indexManager = MockOf<IMongoIndexManager<TDocument>>();\n        indexManager\n            .Setup(\n                x => x.CreateOneAsync(\n                    It.IsAny<CreateIndexModel<TDocument>>(),\n                    It.IsAny<CreateOneIndexOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(indexName);\n\n        collection\n            .SetupGet(x => x.Indexes)\n            .Returns(indexManager.Object);\n\n        return indexManager;\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbIndexHandlerTests/CreateTextIndexAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.Models;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbIndexHandlerTests;\n\npublic class CreateTextIndexAsyncTests : BaseIndexTests\n{\n    private readonly Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;\n\n    [Fact]\n    public async Task WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateTextIndexAsync<TestDocument, Guid>(fieldExpression);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":\\\"text\\\"}\")),\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var options = Fixture.Create<IndexCreationOptions>();\n\n        SetupContext(collection);\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateTextIndexAsync<TestDocument, Guid>(fieldExpression, options);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":\\\"text\\\"}\") &&\n                         t.Options.EqualTo(options)),\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var partitionKey = Fixture.Create<string>();\n\n        var context = SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateTextIndexAsync<TestDocument, Guid>(fieldExpression, partitionKey: partitionKey);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":\\\"text\\\"}\") ),\n                null,\n                CancellationToken.None),\n            Times.Once);\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n\n        SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateTextIndexAsync<TestDocument, Guid>(fieldExpression, cancellationToken: token);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":\\\"text\\\"}\") ),\n                null,\n                token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n        var partitionKey = Fixture.Create<string>();\n        var options = Fixture.Create<IndexCreationOptions>();\n\n        var context = SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        var result = await Sut.CreateTextIndexAsync<TestDocument, Guid>(fieldExpression, options, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expectedIndexName);\n        indexManger.Verify(\n            x => x.CreateOneAsync(\n                It.Is<CreateIndexModel<TestDocument>>(\n                    t => t.Keys.EqualToJson(\"{\\\"SomeContent2\\\":\\\"text\\\"}\") &&\n                         t.Options.EqualTo(options)),\n                null,\n                token),\n            Times.Once);\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n    }\n\n    private Mock<IMongoDbContext> SetupContext<TDocument>(Mock<IMongoCollection<TDocument>> collection)\n    {\n        var context = MockOf<IMongoDbContext>();\n        context\n            .Setup(x => x.GetCollection<TDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        return context;\n    }\n\n    private Mock<IMongoIndexManager<TDocument>> SetupIndexManager<TDocument>(Mock<IMongoCollection<TDocument>> collection, string indexName)\n    {\n        var indexManager = MockOf<IMongoIndexManager<TDocument>>();\n        indexManager\n            .Setup(\n                x => x.CreateOneAsync(\n                    It.IsAny<CreateIndexModel<TDocument>>(),\n                    It.IsAny<CreateOneIndexOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(indexName);\n\n        collection\n            .SetupGet(x => x.Indexes)\n            .Returns(indexManager.Object);\n\n        return indexManager;\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbIndexHandlerTests/DropIndexAsyncTests.cs",
    "content": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbIndexHandlerTests;\n\npublic class DropIndexAsyncTests : BaseIndexTests\n{\n    [Fact]\n    public async Task WithIndexName_DropsIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        await Sut.DropIndexAsync<TestDocument, Guid>(expectedIndexName);\n\n        // Assert\n        indexManger.Verify(x => x.DropOneAsync(expectedIndexName, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithIndexNameAndPartitionKey_DropsIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var partitionKey = Fixture.Create<string>();\n\n        var context = SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        await Sut.DropIndexAsync<TestDocument, Guid>(expectedIndexName, partitionKey);\n\n        // Assert\n        indexManger.Verify(x => x.DropOneAsync(expectedIndexName, CancellationToken.None), Times.Once);\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithIndexNameAndCancellationToken_DropsIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n\n        SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        await Sut.DropIndexAsync<TestDocument, Guid>(expectedIndexName, cancellationToken: token);\n\n        // Assert\n        indexManger.Verify(x => x.DropOneAsync(expectedIndexName, token), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithIndexNameAndPartitionKeyAndCancellationToken_DropsIndex()\n    {\n        // Arrange\n        var expectedIndexName = Fixture.Create<string>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n        var partitionKey = Fixture.Create<string>();\n\n        var context = SetupContext(collection);\n\n        var indexManger = SetupIndexManager(collection, expectedIndexName);\n\n        // Act\n        await Sut.DropIndexAsync<TestDocument, Guid>(expectedIndexName, partitionKey, token);\n\n        // Assert\n        indexManger.Verify(x => x.DropOneAsync(expectedIndexName, token), Times.Once);\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n    }\n\n    private Mock<IMongoDbContext> SetupContext(Mock<IMongoCollection<TestDocument>> collection)\n    {\n        var context = MockOf<IMongoDbContext>();\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        return context;\n    }\n\n    private Mock<IMongoIndexManager<TDocument>> SetupIndexManager<TDocument>(Mock<IMongoCollection<TDocument>> collection, string indexName)\n    {\n        var indexManager = MockOf<IMongoIndexManager<TDocument>>();\n        indexManager\n            .Setup(\n                x => x.CreateOneAsync(\n                    It.IsAny<CreateIndexModel<TDocument>>(),\n                    It.IsAny<CreateOneIndexOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(indexName);\n\n        collection\n            .SetupGet(x => x.Indexes)\n            .Returns(indexManager.Object);\n\n        return indexManager;\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbIndexHandlerTests/GetIndexNamesAsyncTests.cs",
    "content": "using System;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Bson;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbIndexHandlerTests;\n\npublic class GetIndexNamesAsyncTests : BaseIndexTests\n{\n    [Fact]\n    public async Task WithNoParameters_ReturnsAllIndexNames()\n    {\n        // Arrange\n        var indexNames = Fixture.CreateMany<string>().ToList();\n        var indexes = indexNames.Select(x => new BsonDocument {{\"name\", x}}).ToList();\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n\n        var context = MockOf<IMongoDbContext>();\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        var (cursor, manager) = SetupIndexes(indexes, collection);\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocument, Guid>();\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(indexNames);\n        context.Verify(x => x.GetCollection<TestDocument>(null));\n        manager.Verify(x => x.ListAsync(CancellationToken.None));\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithPartitionKey_ReturnsAllIndexNames()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexNames = Fixture.CreateMany<string>().ToList();\n        var indexes = indexNames.Select(x => new BsonDocument {{\"name\", x}}).ToList();\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n\n        var context = MockOf<IMongoDbContext>();\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        var (cursor, manager) = SetupIndexes(indexes, collection);\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocument, Guid>(partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(indexNames);\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey));\n        manager.Verify(x => x.ListAsync(CancellationToken.None));\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithCancellationToken_ReturnsAllIndexNames()\n    {\n        // Arrange\n        var token = new CancellationToken();\n        var indexNames = Fixture.CreateMany<string>().ToList();\n        var indexes = indexNames.Select(x => new BsonDocument {{\"name\", x}}).ToList();\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n\n        var context = MockOf<IMongoDbContext>();\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        var (cursor, manager) = SetupIndexes(indexes, collection);\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocument, Guid>(cancellationToken:token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(indexNames);\n        context.Verify(x => x.GetCollection<TestDocument>(null));\n        manager.Verify(x => x.ListAsync(token));\n        cursor.Verify(x => x.MoveNextAsync(token));\n    }\n\n    [Fact]\n    public async Task WithPartitionKeyCancellationToken_ReturnsAllIndexNames()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken();\n        var indexNames = Fixture.CreateMany<string>().ToList();\n        var indexes = indexNames.Select(x => new BsonDocument {{\"name\", x}}).ToList();\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n\n        var context = MockOf<IMongoDbContext>();\n        context\n            .Setup(x => x.GetCollection<TestDocument>(It.IsAny<string>()))\n            .Returns(collection.Object);\n\n        var (cursor, manager) = SetupIndexes(indexes, collection);\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocument, Guid>(partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(indexNames);\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey));\n        manager.Verify(x => x.ListAsync(token));\n        cursor.Verify(x => x.MoveNextAsync(token));\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/AnyAsyncTests.cs",
    "content": "using System;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class AnyAsyncTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public async Task WithFilter_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocument, Guid>(filter);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), null, CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocument, Guid>(filter, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), null, token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKey_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocument, Guid>(filter, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), null, CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKeyAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocument, Guid>(filter, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), null, token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithCondition_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocument, Guid>(condition);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(condition, null, CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithConditionAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(true);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocument, Guid>(condition, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(condition, null, token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithConditionAndPartitionKey_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocument, Guid>(condition, partitionKey: partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(condition, null, CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithConditionAndPartitionKeyAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocument, Guid>(condition, partitionKey: partitionKey, cancellationToken:token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(condition, null, token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/AnyTests.cs",
    "content": "using System;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class AnyTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public void WithFilter_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Any<TestDocument, Guid>(filter);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), null, CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Any<TestDocument, Guid>(filter, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), null, token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKey_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Any<TestDocument, Guid>(filter, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), null, CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKeyAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Any<TestDocument, Guid>(filter, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), null, token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithCondition_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Any<TestDocument, Guid>(condition);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(condition, null, CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithConditionAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(true);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Any<TestDocument, Guid>(condition, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(condition, null, token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithConditionAndPartitionKey_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Any<TestDocument, Guid>(condition, partitionKey: partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(condition, null, CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithConditionAndPartitionKeyAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Any<TestDocument, Guid>(condition, partitionKey: partitionKey, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(condition, null, token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/BaseReaderTests.cs",
    "content": "using System.Collections.Generic;\nusing System.Threading;\nusing CoreUnitTests.Infrastructure;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class BaseReaderTests : GenericTestContext<MongoDbReader>\n{\n    protected Mock<IAsyncCursor<TDocument>> SetupSyncCursor<TDocument>(List<TDocument> documents)\n    {\n        var asyncCursor = MockOf<IAsyncCursor<TDocument>>();\n\n        var moveNextSequence = asyncCursor\n            .SetupSequence(x => x.MoveNext(It.IsAny<CancellationToken>()));\n\n        var currentSequence = asyncCursor\n            .SetupSequence(x => x.Current);\n\n        foreach (var projection in documents)\n        {\n            moveNextSequence.Returns(true);\n            currentSequence.Returns(new[] {projection});\n        }\n\n        moveNextSequence.Returns(false);\n        return asyncCursor;\n    }\n\n    protected Mock<IAsyncCursor<TDocument>> SetupAsyncCursor<TDocument>(List<TDocument> documents)\n    {\n        var asyncCursor = MockOf<IAsyncCursor<TDocument>>();\n\n        var moveNextSequence = asyncCursor\n            .SetupSequence(x => x.MoveNextAsync(It.IsAny<CancellationToken>()));\n\n        var currentSequence = asyncCursor\n            .SetupSequence(x => x.Current);\n\n        foreach (var projection in documents)\n        {\n            moveNextSequence.ReturnsAsync(true);\n            currentSequence.Returns(new[] {projection});\n        }\n\n        moveNextSequence.ReturnsAsync(false);\n        return asyncCursor;\n    }\n\n    protected static void SetupFindAsync<TDocument, TProjection>(Mock<IMongoCollection<TDocument>> collection, Mock<IAsyncCursor<TProjection>> asyncCursor) =>\n        collection\n            .Setup(\n                x => x.FindAsync(\n                    It.IsAny<FilterDefinition<TDocument>>(),\n                    It.IsAny<FindOptions<TDocument, TProjection>>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(asyncCursor.Object);\n\n    protected static void SetupFindSync<TDocument, TProjection>(Mock<IMongoCollection<TDocument>> collection, Mock<IAsyncCursor<TProjection>> asyncCursor) =>\n        collection\n            .Setup(\n                x => x.FindSync(\n                    It.IsAny<FilterDefinition<TDocument>>(),\n                    It.IsAny<FindOptions<TDocument, TProjection>>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(asyncCursor.Object);\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/CountAsyncTests.cs",
    "content": "using System;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class CountAsyncTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public async Task WithFilter_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocument, Guid>(filter);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), null, CancellationToken.None),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n\n    [Fact]\n    public async Task WithFilterAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocument, Guid>(filter, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), null, token),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKey_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocument, Guid>(filter, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), null, CancellationToken.None),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKeyAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocument, Guid>(filter, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), null, token),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n\n    [Fact]\n    public async Task WithCondition_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocument, Guid>(condition);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(condition, null, CancellationToken.None),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n\n    [Fact]\n    public async Task WithConditionAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(true);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocument, Guid>(condition, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(condition, null, token),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n\n    [Fact]\n    public async Task WithConditionAndPartitionKey_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocument, Guid>(condition, partitionKey: partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(condition, null, CancellationToken.None),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n\n    [Fact]\n    public async Task WithConditionAndPartitionKeyAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocumentsAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents.Count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocument, Guid>(condition, partitionKey: partitionKey, cancellationToken:token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocumentsAsync(condition, null, token),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/CountTests.cs",
    "content": "using System;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class CountTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public void WithFilter_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Count<TestDocument, Guid>(filter);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), It.IsAny<CountOptions>(), CancellationToken.None),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n\n    [Fact]\n    public void WithFilterAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Count<TestDocument, Guid>(filter, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), It.IsAny<CountOptions>(), token),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKey_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Count<TestDocument, Guid>(filter, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), It.IsAny<CountOptions>(), CancellationToken.None),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKeyAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Count<TestDocument, Guid>(filter, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(It.Is<ExpressionFilterDefinition<TestDocument>>(y => y.Expression == filter), It.IsAny<CountOptions>(), token),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n\n    [Fact]\n    public void WithCondition_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Count<TestDocument, Guid>(condition);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(condition, null, CancellationToken.None),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n\n    [Fact]\n    public void WithConditionAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(true);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(null))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Count<TestDocument, Guid>(condition, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(condition, null, token),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n\n    [Fact]\n    public void WithConditionAndPartitionKey_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Count<TestDocument, Guid>(condition, partitionKey: partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(condition, null, CancellationToken.None),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n\n    [Fact]\n    public void WithConditionAndPartitionKeyAndCancellationToken_ReturnsResult()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        collection\n            .Setup(\n                x => x.CountDocuments(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents.Count);\n\n        // Act\n        var result = Sut.Count<TestDocument, Guid>(condition, partitionKey: partitionKey, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        collection.Verify(\n            x => x.CountDocuments(condition, null, token),\n            Times.Once);\n        result.Should().Be(documents.Count);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/GetAllAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class GetAllAsyncTests : BaseReaderTests\n{\n    [Fact]\n    public async Task WithFilter_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocument, Guid>(filter);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public async Task WithFilterAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(false);\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocument, Guid>(filter, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKey_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocument, Guid>(filter, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKeyAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(false);\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocument, Guid>(filter, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public async Task WithCondition_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocument, Guid>(condition);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public async Task WithConditionAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(false);\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocument, Guid>(condition, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public async Task WithConditionAndPartitionKey_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocument, Guid>(condition, partitionKey: partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Exactly(documents.Count + 1));\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public async Task WithConditionAndPartitionKeyAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(false);\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocument, Guid>(condition, partitionKey: partitionKey, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public async Task WithConditionAndFindOptions_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var options = Fixture\n            .Build<FindOptions>()\n            .Without(x => x.Comment)\n            .Without(x => x.Hint)\n            .Create();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocument, Guid>(condition, options);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public async Task WithConditionAndFindOptionsAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var options = Fixture\n            .Build<FindOptions>()\n            .Without(x => x.Comment)\n            .Without(x => x.Hint)\n            .Create();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(false);\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocument, Guid>(condition, options, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public async Task WithConditionAndFindOptionsAndPartitionKeyAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var options = Fixture\n            .Build<FindOptions>()\n            .Without(x => x.Comment)\n            .Without(x => x.Hint)\n            .Create();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(false);\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocument, Guid>(condition, options, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TDocument>>) SetupAsyncGet<TDocument>(\n        List<TDocument> documents,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupAsyncCursor(documents);\n\n        SetupFindAsync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/GetAllTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class GetAllTests : BaseReaderTests\n{\n    [Fact]\n    public void WithFilter_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupGet(documents, collection);\n\n\n        // Act\n        var result = Sut.GetAll<TestDocument, Guid>(filter);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public void WithFilterAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(false);\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupGet(documents, collection);\n\n        // Act\n        var result = Sut.GetAll<TestDocument, Guid>(filter, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNext(token), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKey_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetAll<TestDocument, Guid>(filter, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKeyAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(false);\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetAll<TestDocument, Guid>(filter, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNext(token), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public void WithCondition_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var (context, cursor) = SetupGet(documents, collection);\n\n        // Act\n        var result = Sut.GetAll<TestDocument, Guid>(condition);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public void WithConditionAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(false);\n        var (context, cursor) = SetupGet(documents, collection);\n\n        // Act\n        var result = Sut.GetAll<TestDocument, Guid>(condition, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNext(token), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public void WithConditionAndPartitionKey_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetAll<TestDocument, Guid>(condition, partitionKey: partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Exactly(documents.Count + 1));\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public void WithConditionAndPartitionKeyAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(false);\n        var (context, cursor) = SetupGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetAll<TestDocument, Guid>(condition, partitionKey: partitionKey, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNext(token), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public void WithConditionAndFindOptions_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var options = Fixture\n            .Build<FindOptions>()\n            .Without(x => x.Comment)\n            .Without(x => x.Hint)\n            .Create();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var (context, cursor) = SetupGet(documents, collection);\n\n        // Act\n        var result = Sut.GetAll<TestDocument, Guid>(condition, options);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public void WithConditionAndFindOptionsAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var options = Fixture\n            .Build<FindOptions>()\n            .Without(x => x.Comment)\n            .Without(x => x.Hint)\n            .Create();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(false);\n        var (context, cursor) = SetupGet(documents, collection);\n\n        // Act\n        var result = Sut.GetAll<TestDocument, Guid>(condition, options, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNext(token), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    [Fact]\n    public void WithConditionAndFindOptionsAndPartitionKeyAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var options = Fixture\n            .Build<FindOptions>()\n            .Without(x => x.Comment)\n            .Without(x => x.Hint)\n            .Create();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(false);\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetAll<TestDocument, Guid>(condition, options, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Exactly(documents.Count));\n        cursor.Verify(x => x.MoveNext(token), Times.Exactly(documents.Count + 1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => documents.Contains(x));\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TDocument>>) SetupGet<TDocument>(\n        List<TDocument> documents,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupSyncCursor(documents);\n\n        SetupFindSync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/GetByIdAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class GetByIdAsyncTests : BaseReaderTests\n{\n    [Fact]\n    public async Task WithId_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocument, Guid>(documents[0].Id);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithIdAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocument, Guid>(documents[0].Id, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithIdAndPartitionKey_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocument, Guid>(documents[0].Id, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithIdAndPartitionKeyAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocument, Guid>(documents[0].Id, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TDocument>>) SetupAsyncGet<TDocument>(\n        List<TDocument> documents,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupAsyncCursor(documents);\n\n        SetupFindAsync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/GetByIdTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class GetByIdTests : BaseReaderTests\n{\n    [Fact]\n    public void WithId_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = Sut.GetById<TestDocument, Guid>(documents[0].Id);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithIdAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = Sut.GetById<TestDocument, Guid>(documents[0].Id, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithIdAndPartitionKey_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetById<TestDocument, Guid>(documents[0].Id, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithIdAndPartitionKeyAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetById<TestDocument, Guid>(documents[0].Id, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TDocument>>) SetupAsyncGet<TDocument>(\n        List<TDocument> documents,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupSyncCursor(documents);\n\n        SetupFindSync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/GetByMaxAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class GetByMaxAsyncTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, object>> selector = x => x.SomeValue;\n\n    [Fact]\n    public async Task WithFilterAndSelector_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetByMaxAsync<TestDocument, Guid>(filter, selector);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetByMaxAsync<TestDocument, Guid>(filter, selector, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKey_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetByMaxAsync<TestDocument, Guid>(filter, selector, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetByMaxAsync<TestDocument, Guid>(filter, selector, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TDocument>>) SetupAsyncGet<TDocument>(\n        List<TDocument> documents,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupAsyncCursor(documents);\n\n        SetupFindAsync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/GetByMaxTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class GetByMaxTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, object>> selector = x => x.SomeValue;\n\n    [Fact]\n    public void WithFilterAndSelector_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var (context, cursor) = SetupSyncGet(documents, collection);\n\n        // Act\n        var result = Sut.GetByMax<TestDocument, Guid>(filter, selector);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupSyncGet(documents, collection);\n\n        // Act\n        var result = Sut.GetByMax<TestDocument, Guid>(filter, selector, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKey_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupSyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetByMax<TestDocument, Guid>(filter, selector, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupSyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetByMax<TestDocument, Guid>(filter, selector, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TDocument>>) SetupSyncGet<TDocument>(\n        List<TDocument> documents,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupSyncCursor(documents);\n\n        SetupFindSync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/GetByMinAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class GetByMinAsyncTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, object>> selector = x => x.SomeValue;\n\n    [Fact]\n    public async Task WithFilterAndSelector_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetByMinAsync<TestDocument, Guid>(filter, selector);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetByMinAsync<TestDocument, Guid>(filter, selector, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKey_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetByMinAsync<TestDocument, Guid>(filter, selector, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetByMinAsync<TestDocument, Guid>(filter, selector, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TDocument>>) SetupAsyncGet<TDocument>(\n        List<TDocument> documents,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupAsyncCursor(documents);\n\n        SetupFindAsync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/GetByMinTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class GetByMinTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, object>> selector = x => x.SomeValue;\n\n    [Fact]\n    public void WithFilterAndSelector_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var (context, cursor) = SetupSyncGet(documents, collection);\n\n        // Act\n        var result = Sut.GetByMin<TestDocument, Guid>(filter, selector);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupSyncGet(documents, collection);\n\n        // Act\n        var result = Sut.GetByMin<TestDocument, Guid>(filter, selector, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKey_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupSyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetByMin<TestDocument, Guid>(filter, selector, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupSyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetByMin<TestDocument, Guid>(filter, selector, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TDocument>>) SetupSyncGet<TDocument>(\n        List<TDocument> documents,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupSyncCursor(documents);\n\n        SetupFindSync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/GetMaxValueAsyncTests .cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class GetMaxValueAsyncTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, int>> selector = x => x.SomeValue;\n\n    [Fact]\n    public async Task WithFilterAndSelector_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var (context, cursor) = SetupAsyncGet(value, collection);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync<TestDocument, Guid, int>(filter, selector);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().Be(value);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncGet(value, collection);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync<TestDocument, Guid, int>(filter, selector, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().Be(value);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKey_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupAsyncGet(value, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync<TestDocument, Guid, int>(filter, selector, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().Be(value);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncGet(value, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync<TestDocument, Guid, int>(filter, selector, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().Be(value);\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TValue>>) SetupAsyncGet<TDocument, TValue>(\n        TValue result,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupAsyncCursor(new List<TValue> {result});\n\n        SetupFindAsync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/GetMaxValueTests .cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class GetMaxValueTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, int>> selector = x => x.SomeValue;\n\n    [Fact]\n    public void WithFilterAndSelector_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var (context, cursor) = SetupSyncGet(value, collection);\n\n        // Act\n        var result = Sut.GetMaxValue<TestDocument, Guid, int>(filter, selector);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        result.Should().Be(value);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupSyncGet(value, collection);\n\n        // Act\n        var result = Sut.GetMaxValue<TestDocument, Guid, int>(filter, selector, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().Be(value);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKey_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupSyncGet(value, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetMaxValue<TestDocument, Guid, int>(filter, selector, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        result.Should().Be(value);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupSyncGet(value, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetMaxValue<TestDocument, Guid, int>(filter, selector, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().Be(value);\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TValue>>) SetupSyncGet<TDocument, TValue>(\n        TValue result,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupSyncCursor(new List<TValue> {result});\n\n        SetupFindSync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/GetMinValueAsyncTests .cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class GetMinValueAsyncTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, int>> selector = x => x.SomeValue;\n\n    [Fact]\n    public async Task WithFilterAndSelector_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var (context, cursor) = SetupAsyncGet(value, collection);\n\n        // Act\n        var result = await Sut.GetMinValueAsync<TestDocument, Guid, int>(filter, selector);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().Be(value);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncGet(value, collection);\n\n        // Act\n        var result = await Sut.GetMinValueAsync<TestDocument, Guid, int>(filter, selector, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().Be(value);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKey_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupAsyncGet(value, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetMinValueAsync<TestDocument, Guid, int>(filter, selector, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().Be(value);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncGet(value, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetMinValueAsync<TestDocument, Guid, int>(filter, selector, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().Be(value);\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TValue>>) SetupAsyncGet<TDocument, TValue>(\n        TValue result,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupAsyncCursor(new List<TValue> {result});\n\n        SetupFindAsync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/GetMinValueTests .cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class GetMinValueTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = x => x.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, int>> selector = x => x.SomeValue;\n\n    [Fact]\n    public void WithFilterAndSelector_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var (context, cursor) = SetupSyncGet(value, collection);\n\n        // Act\n        var result = Sut.GetMinValue<TestDocument, Guid, int>(filter, selector);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        result.Should().Be(value);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupSyncGet(value, collection);\n\n        // Act\n        var result = Sut.GetMinValue<TestDocument, Guid, int>(filter, selector, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().Be(value);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKey_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupSyncGet(value, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetMinValue<TestDocument, Guid, int>(filter, selector, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        result.Should().Be(value);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMatchingDocument()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupSyncGet(value, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetMinValue<TestDocument, Guid, int>(filter, selector, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().Be(value);\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TValue>>) SetupSyncGet<TDocument, TValue>(\n        TValue result,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupSyncCursor(new List<TValue> {result});\n\n        SetupFindSync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/GetOneAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class GetOneAsyncTests : BaseReaderTests\n{\n    [Fact]\n    public async Task WithFilter_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocument, Guid>(filter);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithFilterAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocument, Guid>(filter, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKey_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocument, Guid>(filter, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKeyAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocument, Guid>(filter, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithCondition_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocument, Guid>(condition);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithConditionAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocument, Guid>(condition, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithConditionAndPartitionKey_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocument, Guid>(condition, partitionKey: partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithConditionAndPartitionKeyAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocument, Guid>(condition, partitionKey: partitionKey, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithConditionAndFindOptions_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var options = Fixture\n            .Build<FindOptions>()\n            .Without(x => x.Comment)\n            .Without(x => x.Hint)\n            .Create();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocument, Guid>(condition, options);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithConditionAndFindOptionsAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var options = Fixture\n            .Build<FindOptions>()\n            .Without(x => x.Comment)\n            .Without(x => x.Hint)\n            .Create();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncGet(documents, collection);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocument, Guid>(condition, options, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public async Task WithConditionAndFindOptionsAndPartitionKeyAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var options = Fixture\n            .Build<FindOptions>()\n            .Without(x => x.Comment)\n            .Without(x => x.Hint)\n            .Create();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(true);\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupAsyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocument, Guid>(condition, options, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TDocument>>) SetupAsyncGet<TDocument>(\n        List<TDocument> documents,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupAsyncCursor(documents);\n\n        SetupFindAsync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/GetOneTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class GetOneTests : BaseReaderTests\n{\n    [Fact]\n    public void WithFilter_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupSyncGet(documents, collection);\n\n\n        // Act\n        var result = Sut.GetOne<TestDocument, Guid>(filter);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithFilterAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupSyncGet(documents, collection);\n\n        // Act\n        var result = Sut.GetOne<TestDocument, Guid>(filter, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKey_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupSyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetOne<TestDocument, Guid>(filter, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKeyAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filter = x => x.Id == documents[0].Id;\n        var (context, cursor) = SetupSyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetOne<TestDocument, Guid>(filter, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithCondition_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var (context, cursor) = SetupSyncGet(documents, collection);\n\n        // Act\n        var result = Sut.GetOne<TestDocument, Guid>(condition);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithConditionAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupSyncGet(documents, collection);\n\n        // Act\n        var result = Sut.GetOne<TestDocument, Guid>(condition, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithConditionAndPartitionKey_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupSyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetOne<TestDocument, Guid>(condition, partitionKey: partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithConditionAndPartitionKeyAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupSyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetOne<TestDocument, Guid>(condition, partitionKey: partitionKey, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithConditionAndFindOptions_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var options = Fixture\n            .Build<FindOptions>()\n            .Without(x => x.Comment)\n            .Without(x => x.Hint)\n            .Create();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var (context, cursor) = SetupSyncGet(documents, collection);\n\n        // Act\n        var result = Sut.GetOne<TestDocument, Guid>(condition, options);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithConditionAndFindOptionsAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var options = Fixture\n            .Build<FindOptions>()\n            .Without(x => x.Comment)\n            .Without(x => x.Hint)\n            .Create();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupSyncGet(documents, collection);\n\n        // Act\n        var result = Sut.GetOne<TestDocument, Guid>(condition, options, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    [Fact]\n    public void WithConditionAndFindOptionsAndPartitionKeyAndCancellationToken_GetsMatchingDocuments()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        var options = Fixture\n            .Build<FindOptions>()\n            .Without(x => x.Comment)\n            .Without(x => x.Hint)\n            .Create();\n        var condition = Builders<TestDocument>.Filter.Eq(\"Id\", documents[0].Id);\n        var token = new CancellationToken(true);\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupSyncGet(documents, collection, partitionKey);\n\n        // Act\n        var result = Sut.GetOne<TestDocument, Guid>(condition, options, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(documents[0]);\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TDocument>>) SetupSyncGet<TDocument>(\n        List<TDocument> documents,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupSyncCursor(documents);\n\n        SetupFindSync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/ProjectManyAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class ProjectManyAsyncTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = t => string.IsNullOrWhiteSpace(t.SomeContent2);\n\n    private readonly Expression<Func<TestDocument, TestProjection>>\n        projectionExpression = t => new TestProjection {TestDocumentId = t.Id, NestedData = t.Nested.SomeDate};\n\n    [Fact]\n    public async Task WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var (context, cursor) = SetupAsyncProjection(projections, collection);\n\n        // Act\n        var result = await Sut.ProjectManyAsync<TestDocument, TestProjection, Guid>(filter, projectionExpression);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.AtLeast(1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => projections.Contains(x));\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(false);\n        var (context, cursor) = SetupAsyncProjection(projections, collection);\n\n        // Act\n        var result = await Sut.ProjectManyAsync<TestDocument, TestProjection, Guid>(filter, projectionExpression, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.AtLeast(1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => projections.Contains(x));\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupAsyncProjection(projections, collection, partitionKey);\n\n        // Act\n        var result = await Sut.ProjectManyAsync<TestDocument, TestProjection, Guid>(filter, projectionExpression, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.AtLeast(1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => projections.Contains(x));\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(false);\n        var (context, cursor) = SetupAsyncProjection(projections, collection, partitionKey);\n\n        // Act\n        var result = await Sut.ProjectManyAsync<TestDocument, TestProjection, Guid>(filter, projectionExpression, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.AtLeast(1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => projections.Contains(x));\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TProjection>>) SetupAsyncProjection<TDocument, TProjection>(\n        List<TProjection> projections,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupAsyncCursor(projections);\n\n        collection\n            .Setup(\n                x => x.FindAsync(\n                    It.IsAny<FilterDefinition<TDocument>>(),\n                    It.IsAny<FindOptions<TDocument, TProjection>>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(asyncCursor.Object);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/ProjectManyTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class ProjectManyTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = t => string.IsNullOrWhiteSpace(t.SomeContent2);\n\n    private readonly Expression<Func<TestDocument, TestProjection>>\n        projectionExpression = t => new TestProjection {TestDocumentId = t.Id, NestedData = t.Nested.SomeDate};\n\n    [Fact]\n    public void WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var (context, cursor) = SetupAsyncProjection(projections, collection);\n\n        // Act\n        var result = Sut.ProjectMany<TestDocument, TestProjection, Guid>(filter, projectionExpression);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.AtLeast(1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => projections.Contains(x));\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(false);\n        var (context, cursor) = SetupAsyncProjection(projections, collection);\n\n        // Act\n        var result = Sut.ProjectMany<TestDocument, TestProjection, Guid>(filter, projectionExpression, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.AtLeast(1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => projections.Contains(x));\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupAsyncProjection(projections, collection, partitionKey);\n\n        // Act\n        var result = Sut.ProjectMany<TestDocument, TestProjection, Guid>(filter, projectionExpression, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.AtLeast(1));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => projections.Contains(x));\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(false);\n        var (context, cursor) = SetupAsyncProjection(projections, collection, partitionKey);\n\n        // Act\n        var result = Sut.ProjectMany<TestDocument, TestProjection, Guid>(filter, projectionExpression, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.AtLeast(projections.Count));\n        result.Should().NotBeNull();\n        result.Should().OnlyContain(x => projections.Contains(x));\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TProjection>>) SetupAsyncProjection<TDocument, TProjection>(\n        List<TProjection> projections,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupSyncCursor(projections);\n\n        SetupFindSync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/ProjectOneAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class ProjectOneAsyncTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = t => string.IsNullOrWhiteSpace(t.SomeContent2);\n\n    private readonly Expression<Func<TestDocument, TestProjection>>\n        projectionExpression = t => new TestProjection {TestDocumentId = t.Id, NestedData = t.Nested.SomeDate};\n\n    [Fact]\n    public async Task WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var (context, cursor) = SetupAsyncProjection(projections, collection);\n\n        // Act\n        var result = await Sut.ProjectOneAsync<TestDocument, TestProjection, Guid>(filter, projectionExpression);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(projections[0]);\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncProjection(projections, collection);\n\n        // Act\n        var result = await Sut.ProjectOneAsync<TestDocument, TestProjection, Guid>(filter, projectionExpression, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(projections[0]);\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupAsyncProjection(projections, collection, partitionKey);\n\n        // Act\n        var result = await Sut.ProjectOneAsync<TestDocument, TestProjection, Guid>(filter, projectionExpression, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(projections[0]);\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupAsyncProjection(projections, collection, partitionKey);\n\n        // Act\n        var result = await Sut.ProjectOneAsync<TestDocument, TestProjection, Guid>(filter, projectionExpression, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNextAsync(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(projections[0]);\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TProjection>>) SetupAsyncProjection<TDocument, TProjection>(\n        List<TProjection> projections,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupAsyncCursor(projections);\n\n        SetupFindAsync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbReaderTests/ProjectOneTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbReaderTests;\n\npublic class ProjectOneTests : BaseReaderTests\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = t => string.IsNullOrWhiteSpace(t.SomeContent2);\n\n    private readonly Expression<Func<TestDocument, TestProjection>>\n        projectionExpression = t => new TestProjection {TestDocumentId = t.Id, NestedData = t.Nested.SomeDate};\n\n    [Fact]\n    public void WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var (context, cursor) = SetupProjection(projections, collection);\n\n        // Act\n        var result = Sut.ProjectOne<TestDocument, TestProjection, Guid>(filter, projectionExpression);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(projections[0]);\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupProjection(projections, collection);\n\n        // Act\n        var result = Sut.ProjectOne<TestDocument, TestProjection, Guid>(filter, projectionExpression, cancellationToken: token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(null), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(projections[0]);\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var (context, cursor) = SetupProjection(projections, collection, partitionKey);\n\n        // Act\n        var result = Sut.ProjectOne<TestDocument, TestProjection, Guid>(filter, projectionExpression, partitionKey);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(CancellationToken.None), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(projections[0]);\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var (context, cursor) = SetupProjection(projections, collection, partitionKey);\n\n        // Act\n        var result = Sut.ProjectOne<TestDocument, TestProjection, Guid>(filter, projectionExpression, partitionKey, token);\n\n        // Assert\n        context.Verify(x => x.GetCollection<TestDocument>(partitionKey), Times.Once);\n        cursor.Verify(x => x.Current, Times.Once);\n        cursor.Verify(x => x.MoveNext(token), Times.Once);\n        result.Should().NotBeNull();\n        result.Should().Be(projections[0]);\n    }\n\n    private (Mock<IMongoDbContext>, Mock<IAsyncCursor<TProjection>>) SetupProjection<TDocument, TProjection>(\n        List<TProjection> projections,\n        Mock<IMongoCollection<TDocument>> collection,\n        string partitionKey = null)\n    {\n        var asyncCursor = SetupSyncCursor(projections);\n\n        SetupFindSync(collection, asyncCursor);\n\n        var context = MockOf<IMongoDbContext>();\n\n        context\n            .Setup(x => x.GetCollection<TDocument>(partitionKey))\n            .Returns(collection.Object);\n\n        return (context, asyncCursor);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbUpdaterTests/UpdateManyAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Bson;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbUpdaterTests;\n\npublic class UpdateManyAsyncTests : GenericTestContext<MongoDbUpdater>\n{\n    [Fact]\n    public async Task WithFilterAndUpdateDefinition_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var collection = SetupCollection(count);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid>(\n            filter,\n            updateDefinition);\n\n        // Assert\n        result.Should().Be(count);\n\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(updateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterAndUpdateDefinitionAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var collection = SetupCollection(count);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        var token = new CancellationToken(true);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid>(\n            filter,\n            updateDefinition,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().Be(count);\n\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(updateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterAndUpdateDefinitionAndPartitionKey_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var collection = SetupCollection(count, partitionKey);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid>(\n            filter,\n            updateDefinition,\n            partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(updateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterAndUpdateDefinitionAndPartitionKeyAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var collection = SetupCollection(count, partitionKey);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        var token = new CancellationToken(true);\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid>(\n            filter,\n            updateDefinition,\n            partitionKey,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().Be(count);\n\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(updateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterAndFieldExpressionAndValue_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection(count);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid, string>(\n            filter,\n            fieldExpression,\n            value);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n\n    [Fact]\n    public async Task WithFilterAndFieldExpressionAndValueAndPartitionKey_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(count, partitionKey);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid, string>(\n            filter,\n            fieldExpression,\n            value,\n            partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterAndFieldExpressionAndValueAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection(count);\n        var token = new CancellationToken(true);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid, string>(\n            filter,\n            fieldExpression,\n            value,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(count, partitionKey);\n        var token = new CancellationToken(true);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid, string>(\n            filter,\n            fieldExpression,\n            value,\n            partitionKey,\n            token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValue_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection(count);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid, string>(\n            filterExpression,\n            fieldExpression,\n            value);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection(count);\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid, string>(\n            filterExpression,\n            fieldExpression,\n            value,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_UpdatesMany()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var collection = SetupCollection(count, partitionKey);\n\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid, string>(\n            filterExpression,\n            fieldExpression,\n            value,\n            partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(count, partitionKey);\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid, string>(\n            filterExpression,\n            fieldExpression,\n            value,\n            partitionKey,\n            token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndUpdateDefinition_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var collection = SetupCollection(count);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid>(\n            filterExpression,\n            updateDefinition);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndUpdateDefinitionAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var collection = SetupCollection(count);\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid>(\n            filterExpression,\n            updateDefinition,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndUpdateDefinitionAndPartitionKey_UpdatesMany()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var count = Fixture.Create<long>();\n        var collection = SetupCollection(count, partitionKey);\n\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid>(\n            filterExpression,\n            updateDefinition,\n            partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndUpdateDefinitionAndPartitionKeyAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(count, partitionKey);\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n\n        // Act\n        var result = await Sut.UpdateManyAsync<TestDocument, Guid>(\n            filterExpression,\n            updateDefinition,\n            partitionKey,\n            token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateManyAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    private Mock<IMongoCollection<TestDocument>> SetupCollection(long count, string partitionKey = null)\n    {\n        var replacedId = Fixture.Create<Guid>();\n        var replaceResult = new ReplaceOneResult.Acknowledged(count, count, new BsonBinaryData(replacedId, GuidRepresentation.Standard));\n        var updateResult = new UpdateResult.Acknowledged(count, count, new BsonBinaryData(replacedId, GuidRepresentation.Standard));\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        collection\n            .Setup(\n                x => x.ReplaceOneAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<ReplaceOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(replaceResult);\n\n        collection\n            .Setup(\n                x => x.UpdateManyAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<UpdateOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(updateResult);\n\n        collection\n            .Setup(\n                x => x.ReplaceOneAsync(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<ReplaceOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(replaceResult);\n\n        collection\n            .Setup(\n                x => x.UpdateManyAsync(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<UpdateOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(updateResult);\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n        return collection;\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbUpdaterTests/UpdateManyTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Bson;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbUpdaterTests;\n\npublic class UpdateManyTests : GenericTestContext<MongoDbUpdater>\n{\n    [Fact]\n    public void WithFilterAndUpdateDefinition_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var collection = SetupCollection(count);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid>(\n            filter,\n            updateDefinition);\n\n        // Assert\n        result.Should().Be(count);\n\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(updateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterAndUpdateDefinitionAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var collection = SetupCollection(count);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        var token = new CancellationToken(true);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid>(\n            filter,\n            updateDefinition,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().Be(count);\n\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(updateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterAndUpdateDefinitionAndPartitionKey_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var collection = SetupCollection(count, partitionKey);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid>(\n            filter,\n            updateDefinition,\n            partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(updateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterAndUpdateDefinitionAndPartitionKeyAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var collection = SetupCollection(count, partitionKey);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        var token = new CancellationToken(true);\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid>(\n            filter,\n            updateDefinition,\n            partitionKey,\n            token);\n\n        // Assert\n        result.Should().Be(count);\n\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(updateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterAndFieldExpressionAndValue_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection(count);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid, string>(\n            filter,\n            fieldExpression,\n            value);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n\n    [Fact]\n    public void WithFilterAndFieldExpressionAndValueAndPartitionKey_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(count, partitionKey);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid, string>(\n            filter,\n            fieldExpression,\n            value,\n            partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterAndFieldExpressionAndValueAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection(count);\n        var token = new CancellationToken(true);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid, string>(\n            filter,\n            fieldExpression,\n            value,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(count, partitionKey);\n        var token = new CancellationToken(true);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid, string>(\n            filter,\n            fieldExpression,\n            value,\n            partitionKey,\n            token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValue_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection(count);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid, string>(\n            filterExpression,\n            fieldExpression,\n            value);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection(count);\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid, string>(\n            filterExpression,\n            fieldExpression,\n            value,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_UpdatesMany()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var collection = SetupCollection(count, partitionKey);\n\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid, string>(\n            filterExpression,\n            fieldExpression,\n            value,\n            partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(count, partitionKey);\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid, string>(\n            filterExpression,\n            fieldExpression,\n            value,\n            partitionKey,\n            token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndUpdateDefinition_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var collection = SetupCollection(count);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid>(\n            filterExpression,\n            updateDefinition);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndUpdateDefinitionAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var collection = SetupCollection(count);\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid>(\n            filterExpression,\n            updateDefinition,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndUpdateDefinitionAndPartitionKey_UpdatesMany()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var count = Fixture.Create<long>();\n        var collection = SetupCollection(count, partitionKey);\n\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid>(\n            filterExpression,\n            updateDefinition,\n            partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndUpdateDefinitionAndPartitionKeyAndCancellationToken_UpdatesMany()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(count, partitionKey);\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n\n        // Act\n        var result = Sut.UpdateMany<TestDocument, Guid>(\n            filterExpression,\n            updateDefinition,\n            partitionKey,\n            token);\n\n        // Assert\n        result.Should().Be(count);\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateMany(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    private Mock<IMongoCollection<TestDocument>> SetupCollection(long count, string partitionKey = null)\n    {\n        var replacedId = Fixture.Create<Guid>();\n        var replaceResult = new ReplaceOneResult.Acknowledged(count, count, new BsonBinaryData(replacedId, GuidRepresentation.Standard));\n        var updateResult = new UpdateResult.Acknowledged(count, count, new BsonBinaryData(replacedId, GuidRepresentation.Standard));\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        collection\n            .Setup(\n                x => x.ReplaceOneAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<ReplaceOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(replaceResult);\n\n        collection\n            .Setup(\n                x => x.UpdateMany(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<UpdateOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(updateResult);\n\n        collection\n            .Setup(\n                x => x.ReplaceOneAsync(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<ReplaceOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(replaceResult);\n\n        collection\n            .Setup(\n                x => x.UpdateMany(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<UpdateOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(updateResult);\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n        return collection;\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbUpdaterTests/UpdateOneAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Bson;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbUpdaterTests;\n\npublic class UpdateOneAsyncTests : GenericTestContext<MongoDbUpdater>\n{\n    [Fact]\n    public async Task WithDocument_ReplacesOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n\n        var collection = SetupCollection();\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid>(document);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        ReplaceOptions expectedOptions = null;\n        collection\n            .Verify(\n                x => x.ReplaceOneAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    document,\n                    expectedOptions,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithDocumentAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n        var collection = SetupCollection();\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid>(document, token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        ReplaceOptions expectedOptions = null;\n        collection\n            .Verify(\n                x => x.ReplaceOneAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    document,\n                    expectedOptions,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithDocumentAndUpdateDefinition_ReplacesOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var collection = SetupCollection();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.Id, document.Id);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid>(document, updateDefinition);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    updateDefinition,\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithDocumentAndUpdateDefinitionAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var collection = SetupCollection();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.Id, document.Id);\n        var token = new CancellationToken(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid>(document, updateDefinition, token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    updateDefinition,\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithDocumentAndFieldExpressionAndValue_ReplacesOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(document, fieldExpression, value);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithDocumentAndFieldExpressionAndValueAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(document, fieldExpression, value, token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterAndFieldExpressionAndValueAndPartitionKey_ReplacesOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(\n            filter,\n            fieldExpression,\n            value,\n            partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterAndFieldExpressionAndValueAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        var token = new CancellationToken(true);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(\n            filter,\n            fieldExpression,\n            value,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n        var token = new CancellationToken(true);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(\n            filter,\n            fieldExpression,\n            value,\n            partitionKey,\n            token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(\n            filterExpression,\n            fieldExpression,\n            value,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ReplacesOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(\n            filterExpression,\n            fieldExpression,\n            value,\n            partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(\n            filterExpression,\n            fieldExpression,\n            value,\n            partitionKey,\n            token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithClientSessionAndDocument_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var document = Fixture.Create<TestDocument>();\n\n        var collection = SetupCollection();\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid>(session.Object, document);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        ReplaceOptions expectedOptions = null;\n        collection\n            .Verify(\n                x => x.ReplaceOneAsync(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    document,\n                    expectedOptions,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithClientSessionAndDocumentAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n        var collection = SetupCollection();\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid>(session.Object, document, token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        ReplaceOptions expectedOptions = null;\n        collection\n            .Verify(\n                x => x.ReplaceOneAsync(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    document,\n                    expectedOptions,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithClientSessionAndDocumentAndUpdateDefinition_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var document = Fixture.Create<TestDocument>();\n        var collection = SetupCollection();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.Id, document.Id);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid>(session.Object, document, updateDefinition);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    updateDefinition,\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithClientSessionAndDocumentAndUpdateDefinitionAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var document = Fixture.Create<TestDocument>();\n        var collection = SetupCollection();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.Id, document.Id);\n        var token = new CancellationToken(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid>(session.Object, document, updateDefinition, token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    updateDefinition,\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithClientSessionAndDocumentAndFieldExpressionAndValue_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var document = Fixture.Create<TestDocument>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(session.Object, document, fieldExpression, value);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithClientSessionAndDocumentAndFieldExpressionAndValueAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var document = Fixture.Create<TestDocument>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(session.Object, document, fieldExpression, value, token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithClientSessionAndFilterAndFieldExpressionAndValueAndPartitionKey_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(\n            session.Object,\n            filter,\n            fieldExpression,\n            value,\n            partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithClientSessionAndFilterAndFieldExpressionAndValueAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        var token = new CancellationToken(true);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(\n            session.Object,\n            filter,\n            fieldExpression,\n            value,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithClientSessionAndFilterAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n        var token = new CancellationToken(true);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(\n            session.Object,\n            filter,\n            fieldExpression,\n            value,\n            partitionKey,\n            token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithClientSessionAndFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(\n            session.Object,\n            filterExpression,\n            fieldExpression,\n            value,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithClientSessionAndFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(\n            session.Object,\n            filterExpression,\n            fieldExpression,\n            value,\n            partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public async Task WithClientSessionAndFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = await Sut.UpdateOneAsync<TestDocument, Guid, string>(\n            session.Object,\n            filterExpression,\n            fieldExpression,\n            value,\n            partitionKey,\n            token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateOneAsync(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    private Mock<IMongoCollection<TestDocument>> SetupCollection(string partitionKey = null)\n    {\n        var replacedId = Fixture.Create<Guid>();\n        var count = Fixture.Create<long>();\n        var replaceResult = new ReplaceOneResult.Acknowledged(count, 1, new BsonBinaryData(replacedId, GuidRepresentation.Standard));\n        var updateResult = new UpdateResult.Acknowledged(count, 1, new BsonBinaryData(replacedId, GuidRepresentation.Standard));\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        collection\n            .Setup(\n                x => x.ReplaceOneAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<ReplaceOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(replaceResult);\n\n        collection\n            .Setup(\n                x => x.UpdateOneAsync(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<UpdateOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(updateResult);\n\n        collection\n            .Setup(\n                x => x.ReplaceOneAsync(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<ReplaceOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(replaceResult);\n\n        collection\n            .Setup(\n                x => x.UpdateOneAsync(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<UpdateOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(updateResult);\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n        return collection;\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/DataAccessTests/MongoDbUpdaterTests/UpdateOneTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Bson;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.DataAccessTests.MongoDbUpdaterTests;\n\npublic class UpdateOneTests : GenericTestContext<MongoDbUpdater>\n{\n    [Fact]\n    public void WithDocument_ReplacesOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n\n        var collection = SetupCollection();\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid>(document);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        ReplaceOptions expectedOptions = null;\n        collection\n            .Verify(\n                x => x.ReplaceOne(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    document,\n                    expectedOptions,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithDocumentAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n        var collection = SetupCollection();\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid>(document, token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        ReplaceOptions expectedOptions = null;\n        collection\n            .Verify(\n                x => x.ReplaceOne(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    document,\n                    expectedOptions,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithDocumentAndUpdateDefinition_ReplacesOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var collection = SetupCollection();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.Id, document.Id);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid>(document, updateDefinition);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    updateDefinition,\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithDocumentAndUpdateDefinitionAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var collection = SetupCollection();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.Id, document.Id);\n        var token = new CancellationToken(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid>(document, updateDefinition, token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    updateDefinition,\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithDocumentAndFieldExpressionAndValue_ReplacesOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(document, fieldExpression, value);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithDocumentAndFieldExpressionAndValueAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(document, fieldExpression, value, token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterAndFieldExpressionAndValueAndPartitionKey_ReplacesOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(\n            filter,\n            fieldExpression,\n            value,\n            partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterAndFieldExpressionAndValueAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        var token = new CancellationToken(true);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(\n            filter,\n            fieldExpression,\n            value,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n        var token = new CancellationToken(true);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(\n            filter,\n            fieldExpression,\n            value,\n            partitionKey,\n            token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(\n            filterExpression,\n            fieldExpression,\n            value,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ReplacesOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(\n            filterExpression,\n            fieldExpression,\n            value,\n            partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(\n            filterExpression,\n            fieldExpression,\n            value,\n            partitionKey,\n            token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithClientSessionAndDocument_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var document = Fixture.Create<TestDocument>();\n\n        var collection = SetupCollection();\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid>(session.Object, document);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        ReplaceOptions expectedOptions = null;\n        collection\n            .Verify(\n                x => x.ReplaceOne(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    document,\n                    expectedOptions,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithClientSessionAndDocumentAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n        var collection = SetupCollection();\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid>(session.Object, document, token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        ReplaceOptions expectedOptions = null;\n        collection\n            .Verify(\n                x => x.ReplaceOne(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    document,\n                    expectedOptions,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithClientSessionAndDocumentAndUpdateDefinition_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var document = Fixture.Create<TestDocument>();\n        var collection = SetupCollection();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.Id, document.Id);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid>(session.Object, document, updateDefinition);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    updateDefinition,\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithClientSessionAndDocumentAndUpdateDefinitionAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var document = Fixture.Create<TestDocument>();\n        var collection = SetupCollection();\n        var updateDefinition = Builders<TestDocument>.Update.Set(x => x.Id, document.Id);\n        var token = new CancellationToken(true);\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid>(session.Object, document, updateDefinition, token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    updateDefinition,\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithClientSessionAndDocumentAndFieldExpressionAndValue_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var document = Fixture.Create<TestDocument>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(session.Object, document, fieldExpression, value);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithClientSessionAndDocumentAndFieldExpressionAndValueAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var document = Fixture.Create<TestDocument>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(session.Object, document, fieldExpression, value, token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedFilter = Builders<TestDocument>.Filter.Eq(\"Id\", document.Id);\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithClientSessionAndFilterAndFieldExpressionAndValueAndPartitionKey_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(\n            session.Object,\n            filter,\n            fieldExpression,\n            value,\n            partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithClientSessionAndFilterAndFieldExpressionAndValueAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        var token = new CancellationToken(true);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(\n            session.Object,\n            filter,\n            fieldExpression,\n            value,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithClientSessionAndFilterAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n        var token = new CancellationToken(true);\n        var filter = Builders<TestDocument>.Filter.Eq(x => x.SomeContent, \"SomeContent\");\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(\n            session.Object,\n            filter,\n            fieldExpression,\n            value,\n            partitionKey,\n            token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(filter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithClientSessionAndFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var value = Fixture.Create<string>();\n        var collection = SetupCollection();\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(\n            session.Object,\n            filterExpression,\n            fieldExpression,\n            value,\n            cancellationToken: token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithClientSessionAndFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(\n            session.Object,\n            filterExpression,\n            fieldExpression,\n            value,\n            partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    CancellationToken.None),\n                Times.Once());\n    }\n\n    [Fact]\n    public void WithClientSessionAndFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ReplacesOne()\n    {\n        // Arrange\n        var session = MockOf<IClientSessionHandle>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var collection = SetupCollection(partitionKey);\n        var token = new CancellationToken(true);\n        Expression<Func<TestDocument, bool>> filterExpression = testDocument => testDocument.SomeContent == \"SomeContent\";\n        Expression<Func<TestDocument, string>> fieldExpression = testDocument => testDocument.SomeContent;\n\n        // Act\n        var result = Sut.UpdateOne<TestDocument, Guid, string>(\n            session.Object,\n            filterExpression,\n            fieldExpression,\n            value,\n            partitionKey,\n            token);\n\n        // Assert\n        result.Should().BeTrue();\n\n        var expectedUpdateDefinition = Builders<TestDocument>.Update.Set(x => x.SomeContent, value);\n        var expectedFilter = Builders<TestDocument>.Filter.Where(filterExpression);\n        collection\n            .Verify(\n                x => x.UpdateOne(\n                    session.Object,\n                    It.Is<FilterDefinition<TestDocument>>(f => f.EquivalentTo(expectedFilter)),\n                    It.Is<UpdateDefinition<TestDocument>>(u => u.EquivalentTo(expectedUpdateDefinition)),\n                    null,\n                    token),\n                Times.Once());\n    }\n\n    private Mock<IMongoCollection<TestDocument>> SetupCollection(string partitionKey = null)\n    {\n        var replacedId = Fixture.Create<Guid>();\n        var count = Fixture.Create<long>();\n        var replaceResult = new ReplaceOneResult.Acknowledged(count, 1, new BsonBinaryData(replacedId, GuidRepresentation.Standard));\n        var updateResult = new UpdateResult.Acknowledged(count, 1, new BsonBinaryData(replacedId, GuidRepresentation.Standard));\n\n        var collection = MockOf<IMongoCollection<TestDocument>>();\n        collection\n            .Setup(\n                x => x.ReplaceOne(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<ReplaceOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(replaceResult);\n\n        collection\n            .Setup(\n                x => x.UpdateOne(\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<UpdateOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(updateResult);\n\n        collection\n            .Setup(\n                x => x.ReplaceOne(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<TestDocument>(),\n                    It.IsAny<ReplaceOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(replaceResult);\n\n        collection\n            .Setup(\n                x => x.UpdateOne(\n                    It.IsAny<IClientSessionHandle>(),\n                    It.IsAny<FilterDefinition<TestDocument>>(),\n                    It.IsAny<UpdateDefinition<TestDocument>>(),\n                    It.IsAny<UpdateOptions>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(updateResult);\n\n        var dbContext = MockOf<IMongoDbContext>();\n        dbContext\n            .Setup(x => x.GetCollection<TestDocument>(partitionKey))\n            .Returns(collection.Object);\n        return collection;\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/FilterDefinitionExtensions.cs",
    "content": "namespace CoreUnitTests.Infrastructure;\n\nusing MongoDB.Bson;\nusing MongoDB.Bson.Serialization;\nusing MongoDB.Driver;\n\npublic static class FilterDefinitionExtensions\n{\n    public static string RenderToJson<TDocument>(this FilterDefinition<TDocument> filter)\n        => filter.Render(new RenderArgs<TDocument>(BsonSerializer.SerializerRegistry.GetSerializer<TDocument>(), BsonSerializer.SerializerRegistry)).ToJson();\n\n    public static bool EquivalentTo<TDocument>(this FilterDefinition<TDocument> filter, FilterDefinition<TDocument> other)\n        => filter.RenderToJson() == other.RenderToJson();\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/GenericTestContext.cs",
    "content": "using AutoFixture;\nusing AutoFixture.AutoMoq;\nusing Moq;\n\nnamespace CoreUnitTests.Infrastructure;\n\npublic class GenericTestContext<TSut>\n{\n    public GenericTestContext() => Fixture = new Fixture().Customize(new AutoMoqCustomization());\n\n    protected Mock<T> MockOf<T>()\n        where T : class =>\n        Fixture.Freeze<Mock<T>>();\n\n    protected IFixture Fixture { get; set; }\n\n    protected TSut Sut => Fixture.Create<TSut>();\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/IndexExtensions.cs",
    "content": "using System;\nusing MongoDB.Bson.Serialization;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.Models;\nusing Xunit.Abstractions;\n\nnamespace CoreUnitTests.Infrastructure;\n\npublic static class IndexExtensions\n{\n    public static bool EqualToJson<TDocument>(this IndexKeysDefinition<TDocument> keys, string json, ITestOutputHelper output)\n    {\n        var indexModelRendered = RenderIndexModelKeys(keys);\n        var result = indexModelRendered.Equals(json, StringComparison.Ordinal);\n        if (!result && output != null)\n        {\n            output.WriteLine($\"Expected: {json}\");\n            output.WriteLine($\"Actual: {indexModelRendered}\");\n        }\n\n        return result;\n    }\n\n    public static bool EqualToJson<TDocument>(this IndexKeysDefinition<TDocument> keys, string json)\n    {\n        var indexModelRendered = RenderIndexModelKeys(keys);\n        return indexModelRendered.Equals(json, StringComparison.Ordinal);\n    }\n\n    public static bool EqualTo(this IndexCreationOptions x, CreateIndexOptions y) =>\n        x.Unique == y.Unique &&\n        x.TextIndexVersion == y.TextIndexVersion &&\n        x.SphereIndexVersion == y.SphereIndexVersion &&\n        x.Sparse == y.Sparse &&\n        x.Name == y.Name &&\n        x.Min == y.Min &&\n        x.Max == y.Max &&\n        x.LanguageOverride == y.LanguageOverride &&\n        x.ExpireAfter == y.ExpireAfter &&\n        x.DefaultLanguage == y.DefaultLanguage &&\n        x.Bits == y.Bits &&\n        x.Background == y.Background &&\n        x.Version == y.Version;\n\n    public static bool EqualTo(this CreateIndexOptions x, IndexCreationOptions y) =>\n        x.Unique == y.Unique &&\n        x.TextIndexVersion == y.TextIndexVersion &&\n        x.SphereIndexVersion == y.SphereIndexVersion &&\n        x.Sparse == y.Sparse &&\n        x.Name == y.Name &&\n        x.Min == y.Min &&\n        x.Max == y.Max &&\n        x.LanguageOverride == y.LanguageOverride &&\n        x.ExpireAfter == y.ExpireAfter &&\n        x.DefaultLanguage == y.DefaultLanguage &&\n        x.Bits == y.Bits &&\n        x.Background == y.Background &&\n        x.Version == y.Version;\n\n    private static string RenderIndexModelKeys<TDocument>(IndexKeysDefinition<TDocument> keys)\n    {\n        var indexModelRendered = keys.Render(new RenderArgs<TDocument>(\n            BsonSerializer.SerializerRegistry.GetSerializer<TDocument>(), BsonSerializer.SerializerRegistry));\n\n        var result = indexModelRendered.ToString();\n        return result.Replace(\" \", \"\");\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/Model/Child.cs",
    "content": "namespace CoreUnitTests.Infrastructure.Model;\n\npublic class Child\n{\n    public Child(string type, string value)\n    {\n        Type = type;\n        Value = value;\n    }\n\n    public string Type { get; set; }\n    public string Value { get; set; }\n}"
  },
  {
    "path": "CoreUnitTests/Infrastructure/Model/Nested.cs",
    "content": "using System;\nusing MongoDB.Bson;\nusing MongoDB.Bson.Serialization.Attributes;\n\nnamespace CoreUnitTests.Infrastructure.Model;\n\npublic class Nested\n{\n    public DateTime SomeDate { get; set; }\n\n    [BsonRepresentation(BsonType.Decimal128)]\n    public decimal SomeAmount { get; set; }\n}"
  },
  {
    "path": "CoreUnitTests/Infrastructure/Model/PartitionedTestDocument.cs",
    "content": "using MongoDbGenericRepository.Models;\n\nnamespace CoreUnitTests.Infrastructure.Model;\n\npublic class PartitionedTestDocument : TestDocument, IPartitionedDocument\n{\n    /// <inheritdoc />\n    public string PartitionKey { get; set; } = \"PartitionedTestDocument\";\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/Model/TestDocument.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing MongoDbGenericRepository.Models;\n\nnamespace CoreUnitTests.Infrastructure.Model;\n\npublic class TestDocument : Document\n{\n    public TestDocument()\n    {\n        Version = 2;\n        Nested = new Nested {SomeDate = DateTime.UtcNow};\n        Children = new List<Child>();\n    }\n\n    public int SomeValue { get; set; }\n\n    public decimal SomeDecimalValue { get; set; }\n\n    public string SomeContent { get; set; }\n\n    public string SomeContent2 { get; set; }\n\n    public string SomeContent3 { get; set; }\n\n    public int GroupingKey { get; set; }\n\n    public Guid OtherGroupingKey { get; set; }\n\n    public Nested Nested { get; set; }\n\n    public List<Child> Children { get; set; }\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/Model/TestDocumentWithKey.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing MongoDbGenericRepository.Models;\n\nnamespace CoreUnitTests.Infrastructure.Model;\n\npublic class TestDocumentWithKey<TKey> : IDocument<TKey>\n    where TKey : IEquatable<TKey>\n{\n    public TKey Id { get; set; }\n    public int Version { get; set; }\n\n    public TestDocumentWithKey()\n    {\n        Version = 2;\n        Nested = new Nested\n        {\n            SomeDate = DateTime.UtcNow\n        };\n        Children = new List<Child>();\n    }\n\n    public int SomeValue { get; set; }\n\n    public int SomeDecimalValue { get; set; }\n\n    public string SomeContent { get; set; }\n    public string SomeContent2 { get; set; }\n    public string SomeContent3 { get; set; }\n\n    public int GroupingKey { get; set; }\n\n    public Nested Nested { get; set; }\n\n    public List<Child> Children { get; set; }\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/Model/TestProjection.cs",
    "content": "using System;\n\nnamespace CoreUnitTests.Infrastructure.Model;\n\npublic class TestProjection\n{\n    public Guid TestDocumentId { get; set; }\n\n    public DateTime NestedData { get; set; }\n\n    public int Count { get; set; }\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/TestKeyedMongoRepository.cs",
    "content": "using System;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing MongoDbGenericRepository.DataAccess.Update;\n\nnamespace CoreUnitTests.Infrastructure;\n\npublic class TestKeyedMongoRepository<TKey> : BaseMongoRepository<TKey>\n    where TKey : IEquatable<TKey>\n{\n    public TestKeyedMongoRepository(IMongoDatabase mongoDatabase)\n        : base(mongoDatabase)\n    {\n    }\n\n    public void SetIndexHandler(IMongoDbIndexHandler indexHandler) => MongoDbIndexHandler = indexHandler;\n\n    public void SetDbCreator(IMongoDbCreator creator) => MongoDbCreator = creator;\n\n    public void SetReader(IMongoDbReader reader) => MongoDbReader = reader;\n\n    public void SetEraser(IMongoDbEraser eraser) => MongoDbEraser = eraser;\n\n    public void SetUpdater(IMongoDbUpdater updater) => MongoDbUpdater = updater;\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/TestKeyedMongoRepositoryContext.cs",
    "content": "using System;\nusing AutoFixture;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing Moq;\n\nnamespace CoreUnitTests.Infrastructure;\n\npublic class TestKeyedMongoRepositoryContext<TKey>\n    where TKey : IEquatable<TKey>\n{\n    private readonly Mock<IMongoDatabase> mongoDatabase;\n\n    private TestKeyedMongoRepository<TKey> sut;\n\n    protected TestKeyedMongoRepositoryContext()\n    {\n        mongoDatabase = new Mock<IMongoDatabase>();\n        Fixture = new Fixture();\n    }\n\n    protected Fixture Fixture { get; set; }\n\n    protected TestKeyedMongoRepository<TKey> Sut\n    {\n        get\n        {\n            if (sut != null)\n            {\n                return sut;\n            }\n\n            sut = new TestKeyedMongoRepository<TKey>(mongoDatabase.Object);\n            if (IndexHandler != null)\n            {\n                sut.SetIndexHandler(IndexHandler.Object);\n            }\n\n            if (Creator != null)\n            {\n                sut.SetDbCreator(Creator.Object);\n            }\n\n            if (Reader != null)\n            {\n                sut.SetReader(Reader.Object);\n            }\n\n            if (Eraser != null)\n            {\n                sut.SetEraser(Eraser.Object);\n            }\n\n            if (Updater != null)\n            {\n                sut.SetUpdater(Updater.Object);\n            }\n\n            return sut;\n        }\n    }\n\n    protected Mock<IMongoDbIndexHandler> IndexHandler { get; set; }\n\n    protected Mock<IMongoDbCreator> Creator { get; set; }\n\n    protected Mock<IMongoDbReader> Reader { get; set; }\n\n    protected Mock<IMongoDbEraser> Eraser { get; set; }\n\n    protected Mock<IMongoDbUpdater> Updater { get; set; }\n\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/TestKeyedReadOnlyMongoRepository.cs",
    "content": "using System;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Read;\n\nnamespace CoreUnitTests.Infrastructure;\n\npublic class TestKeyedReadOnlyMongoRepository<TKey> : ReadOnlyMongoRepository<TKey>\n    where TKey : IEquatable<TKey>\n{\n    /// <inheritdoc />\n    public TestKeyedReadOnlyMongoRepository(string connectionString, string databaseName = null)\n        : base(connectionString, databaseName)\n    {\n    }\n\n    /// <inheritdoc />\n    public TestKeyedReadOnlyMongoRepository(IMongoDatabase mongoDatabase)\n        : base(mongoDatabase)\n    {\n    }\n\n    /// <inheritdoc />\n    public TestKeyedReadOnlyMongoRepository(IMongoDbContext mongoDbContext)\n        : base(mongoDbContext)\n    {\n    }\n\n    public void SetReader(IMongoDbReader reader) => MongoDbReader = reader;\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/TestKeyedReadOnlyMongoRepositoryContext.cs",
    "content": "using System;\nusing AutoFixture;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\n\nnamespace CoreUnitTests.Infrastructure;\n\npublic class TestKeyedReadOnlyMongoRepositoryContext<TKey>\n    where TKey : IEquatable<TKey>\n{\n    private readonly Mock<IMongoDatabase> mongoDatabase;\n\n    private TestKeyedReadOnlyMongoRepository<TKey> sut;\n\n    protected TestKeyedReadOnlyMongoRepositoryContext()\n    {\n        mongoDatabase = new Mock<IMongoDatabase>();\n        Fixture = new Fixture();\n    }\n\n    protected Fixture Fixture { get; set; }\n\n    protected TestKeyedReadOnlyMongoRepository<TKey> Sut\n    {\n        get\n        {\n            if (sut != null)\n            {\n                return sut;\n            }\n\n            sut = new TestKeyedReadOnlyMongoRepository<TKey>(mongoDatabase.Object);\n\n            if (Reader != null)\n            {\n                sut.SetReader(Reader.Object);\n            }\n\n            return sut;\n        }\n    }\n\n    protected Mock<IMongoDbReader> Reader { get; set; }\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/TestMongoRepository.cs",
    "content": "using MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing MongoDbGenericRepository.DataAccess.Update;\n\nnamespace CoreUnitTests.Infrastructure;\n\npublic class TestMongoRepository : BaseMongoRepository\n{\n    public TestMongoRepository(IMongoDatabase mongoDatabase)\n        : base(mongoDatabase)\n    {\n    }\n\n    public void SetIndexHandler(IMongoDbIndexHandler indexHandler) => MongoDbIndexHandler = indexHandler;\n\n    public void SetDbCreator(IMongoDbCreator creator) => MongoDbCreator = creator;\n\n    public void SetReader(IMongoDbReader reader) => MongoDbReader = reader;\n\n    public void SetEraser(IMongoDbEraser eraser) => MongoDbEraser = eraser;\n\n    public void SetUpdater(IMongoDbUpdater updater) => MongoDbUpdater = updater;\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/TestMongoRepositoryContext.cs",
    "content": "using AutoFixture;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing Moq;\n\nnamespace CoreUnitTests.Infrastructure;\n\npublic class TestMongoRepositoryContext\n{\n    private readonly Mock<IMongoDatabase> _mongoDatabase;\n\n    private TestMongoRepository _sut;\n\n    protected TestMongoRepositoryContext()\n    {\n        _mongoDatabase = new Mock<IMongoDatabase>();\n        Fixture = new Fixture();\n    }\n\n    public Fixture Fixture { get; set; }\n\n    protected TestMongoRepository Sut\n    {\n        get\n        {\n            if (_sut == null)\n            {\n                _sut = new TestMongoRepository(_mongoDatabase.Object);\n                if (IndexHandler != null)\n                {\n                    _sut.SetIndexHandler(IndexHandler.Object);\n                }\n\n                if (Creator != null)\n                {\n                    _sut.SetDbCreator(Creator.Object);\n                }\n\n                if (Reader != null)\n                {\n                    _sut.SetReader(Reader.Object);\n                }\n\n                if (Eraser != null)\n                {\n                    _sut.SetEraser(Eraser.Object);\n                }\n\n                if (Updater != null)\n                {\n                    _sut.SetUpdater(Updater.Object);\n                }\n            }\n\n            return _sut;\n        }\n    }\n\n    protected Mock<IMongoDbIndexHandler> IndexHandler { get; set; }\n\n    protected Mock<IMongoDbCreator> Creator { get; set; }\n\n    protected Mock<IMongoDbReader> Reader { get; set; }\n\n    protected Mock<IMongoDbEraser> Eraser { get; set; }\n\n    protected Mock<IMongoDbUpdater> Updater { get; set; }\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/TestReadOnlyMongoRepository.cs",
    "content": "using System;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.DataAccess.Read;\n\nnamespace CoreUnitTests.Infrastructure;\n\npublic class TestReadOnlyMongoRepository : ReadOnlyMongoRepository\n{\n    /// <inheritdoc />\n    public TestReadOnlyMongoRepository(string connectionString, string databaseName = null)\n        : base(connectionString, databaseName)\n    {\n    }\n\n    /// <inheritdoc />\n    public TestReadOnlyMongoRepository(IMongoDatabase mongoDatabase)\n        : base(mongoDatabase)\n    {\n    }\n\n    /// <inheritdoc />\n    public TestReadOnlyMongoRepository(IMongoDbContext mongoDbContext)\n        : base(mongoDbContext)\n    {\n    }\n\n    public void SetReader(IMongoDbReader reader) => MongoDbReader = reader;\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/TestReadOnlyMongoRepositoryContext.cs",
    "content": "using System;\nusing AutoFixture;\nusing AutoFixture.AutoMoq;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\n\nnamespace CoreUnitTests.Infrastructure;\n\npublic class TestReadOnlyMongoRepositoryContext\n{\n    private readonly Mock<IMongoDatabase> mongoDatabase;\n\n    private TestReadOnlyMongoRepository sut;\n\n    protected TestReadOnlyMongoRepositoryContext()\n    {\n        mongoDatabase = new Mock<IMongoDatabase>();\n        Fixture = new Fixture().Customize(new AutoMoqCustomization());\n    }\n\n    protected IFixture Fixture { get; set; }\n\n    protected TestReadOnlyMongoRepository Sut\n    {\n        get\n        {\n            if (sut != null)\n            {\n                return sut;\n            }\n\n            sut = Fixture.Create<TestReadOnlyMongoRepository>();\n\n            if (Reader != null)\n            {\n                sut.SetReader(Reader.Object);\n            }\n\n            return sut;\n        }\n    }\n\n    protected Mock<IMongoDbReader> Reader { get; set; }\n\n    protected Mock<T> MockOf<T>()\n        where T : class =>\n        Fixture.Freeze<Mock<T>>();\n}\n"
  },
  {
    "path": "CoreUnitTests/Infrastructure/UpdateDefinitionExtensions.cs",
    "content": "using System;\nusing MongoDB.Bson.Serialization;\nusing MongoDB.Driver;\n\nnamespace CoreUnitTests.Infrastructure;\n\npublic static class UpdateDefinitionExtensions\n{\n    public static bool EquivalentTo<TDocument>(this UpdateDefinition<TDocument> update, UpdateDefinition<TDocument> expected)\n    {\n        var renderedUpdate = update.Render(new RenderArgs<TDocument>(\n            BsonSerializer.SerializerRegistry.GetSerializer<TDocument>(),\n            BsonSerializer.SerializerRegistry));\n\n        var renderedExpected = expected.Render(new RenderArgs<TDocument>(\n            BsonSerializer.SerializerRegistry.GetSerializer<TDocument>(),\n            BsonSerializer.SerializerRegistry));\n\n        return renderedUpdate.Equals(renderedExpected);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/AddTests/AddManyAsyncTests.cs",
    "content": "using System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.AddTests;\n\npublic class AddManyAsyncTests : TestKeyedMongoRepositoryContext<int>\n{\n    [Fact]\n    public async Task WithDocument_ShouldAddOne()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        await Sut.AddManyAsync(documents);\n\n        // Assert\n        Creator.Verify(x => x.AddManyAsync<TestDocumentWithKey<int>, int>(documents, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithDocumentAndCancellationToken_ShouldAddOne()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var token = new CancellationToken(true);\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        await Sut.AddManyAsync(documents, token);\n\n        // Assert\n        Creator.Verify(x => x.AddManyAsync<TestDocumentWithKey<int>, int>(documents, token), Times.Once);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/AddTests/AddManyTests.cs",
    "content": "using System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.AddTests;\n\npublic class AddManyTests : TestKeyedMongoRepositoryContext<int>\n{\n    [Fact]\n    public void WithDocument_ShouldAddOne()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        Sut.AddMany(documents);\n\n        // Assert\n        Creator.Verify(x => x.AddMany<TestDocumentWithKey<int>, int>(documents, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithDocumentAndCancellationToken_ShouldAddOne()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var token = new CancellationToken(true);\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        Sut.AddMany(documents, token);\n\n        // Assert\n        Creator.Verify(x => x.AddMany<TestDocumentWithKey<int>, int>(documents, token), Times.Once);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/AddTests/AddOneAsyncTests.cs",
    "content": "using System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.AddTests;\n\npublic class AddOneAsyncTests : TestKeyedMongoRepositoryContext<int>\n{\n    [Fact]\n    public async Task WithDocument_ShouldAddOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        await Sut.AddOneAsync(document);\n\n        // Assert\n        Creator.Verify(x => x.AddOneAsync<TestDocumentWithKey<int>, int>(document, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithDocumentAndCancellationToken_ShouldAddOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        await Sut.AddOneAsync(document, token);\n\n        // Assert\n        Creator.Verify(x => x.AddOneAsync<TestDocumentWithKey<int>, int>(document, token), Times.Once);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/AddTests/AddOneTests.cs",
    "content": "using System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.AddTests;\n\npublic class AddOneTests : TestKeyedMongoRepositoryContext<int>\n{\n    [Fact]\n    public void WithDocument_ShouldAddOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        Sut.AddOne(document);\n\n        // Assert\n        Creator.Verify(x => x.AddOne<TestDocumentWithKey<int>, int>(document, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithDocumentAndCancellationToken_ShouldAddOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        Creator = new Mock<IMongoDbCreator>();\n\n        // Act\n        Sut.AddOne(document, token);\n\n        // Assert\n        Creator.Verify(x => x.AddOne<TestDocumentWithKey<int>, int>(document, token), Times.Once);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/DeleteTests/DeleteManyAsyncTests.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.DeleteTests;\n\npublic class DeleteManyAsyncTests : TestKeyedMongoRepositoryContext<int>\n{\n    [Fact]\n    public async Task WithDocuments_ShouldDeleteMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var count = Fixture.Create<long>();\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(It.IsAny<IEnumerable<TestDocumentWithKey<int>>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync(documents);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(documents, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithDocumentsAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var count = Fixture.Create<long>();\n        var cancellationToken = new CancellationToken(true);\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(It.IsAny<IEnumerable<TestDocumentWithKey<int>>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync(documents, cancellationToken);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(documents, cancellationToken), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilter_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(\n                It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync(filter);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(\n                It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync(filter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(filter, null, token), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKey_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(\n                It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync(filter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKeyAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(\n                It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteManyAsync(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteManyAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, token), Times.Once);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/DeleteTests/DeleteManyTests.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.DeleteTests;\n\npublic class DeleteManyTests : TestKeyedMongoRepositoryContext<int>\n{\n    [Fact]\n    public void WithDocuments_ShouldDeleteMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var count = Fixture.Create<long>();\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocumentWithKey<int>, int>(It.IsAny<IEnumerable<TestDocumentWithKey<int>>>(), CancellationToken.None))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany(documents);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocumentWithKey<int>, int>(documents, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithDocumentsAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocumentWithKey<int>, int>(It.IsAny<IEnumerable<TestDocumentWithKey<int>>>(), It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany(documents, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocumentWithKey<int>, int>(documents, token), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilter_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocumentWithKey<int>, int>(It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(), null, CancellationToken.None))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany(filter);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(\n                x => x.DeleteMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany(filter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocumentWithKey<int>, int>(filter, null, token), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKey_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(\n                x => x.DeleteMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    CancellationToken.None))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany(filter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKeyAndCancellationToken_ShouldDeleteMany()\n    {\n        // Arrange\n        var content = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteMany<TestDocumentWithKey<int>, int>(\n                It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteMany(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteMany<TestDocumentWithKey<int>, int>(filter, partitionKey, token), Times.Once);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/DeleteTests/DeleteOneAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.DeleteTests;\n\npublic class DeleteOneAsyncTests : TestKeyedMongoRepositoryContext<int>\n{\n    [Fact]\n    public async Task WithDocument_ShouldDeleteOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var count = Fixture.Create<long>();\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<TestDocumentWithKey<int>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync(document);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(document, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithDocumentAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<TestDocumentWithKey<int>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync(document, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(document, token), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilter_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync(filter);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync(filter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(filter, null, token), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKey_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync(filter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKeyAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.DeleteOneAsync(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOneAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, token), Times.Once);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/DeleteTests/DeleteOneTests.cs",
    "content": "﻿using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.DeleteTests;\n\npublic class DeleteOneTests : TestKeyedMongoRepositoryContext<int>\n{\n    [Fact]\n    public void WithDocument_ShouldDeleteOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var count = Fixture.Create<long>();\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOne<TestDocumentWithKey<int>, int>(\n                It.IsAny<TestDocumentWithKey<int>>(),\n                It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne(document);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocumentWithKey<int>, int>(document, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithDocumentAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOne<TestDocumentWithKey<int>, int>(\n                It.IsAny<TestDocumentWithKey<int>>(),\n                It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne(document, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocumentWithKey<int>, int>(document, token), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilter_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOne<TestDocumentWithKey<int>, int>(\n                It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne(filter);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOne<TestDocumentWithKey<int>, int>(\n                It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne(filter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocumentWithKey<int>, int>(filter, null, token), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKey_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOne<TestDocumentWithKey<int>, int>(\n                It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne(filter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None), Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKeyAndCancellationToken_ShouldDeleteOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var content = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        Expression<Func<TestDocumentWithKey<int>, bool>> filter = x => x.SomeContent == content;\n\n        Eraser = new Mock<IMongoDbEraser>();\n\n        Eraser\n            .Setup(x => x.DeleteOne<TestDocumentWithKey<int>, int>(\n                It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                It.IsAny<string>(),\n                It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.DeleteOne(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Eraser.Verify(x => x.DeleteOne<TestDocumentWithKey<int>, int>(filter, partitionKey, token), Times.Once);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/IndexTests/CreateAscendingIndexAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.Models;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.IndexTests;\n\npublic class CreateAscendingIndexAsyncTests : TestKeyedMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedFieldExpression = t => t.SomeContent2;\n\n    [Fact]\n    public async Task WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(keyedFieldExpression);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(keyedFieldExpression, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(keyedFieldExpression, options);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(keyedFieldExpression, options, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(keyedFieldExpression, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(keyedFieldExpression, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(keyedFieldExpression, options, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateAscendingIndexAsync(keyedFieldExpression, options, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, token));\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/IndexTests/CreateCombinedTextIndexAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.Models;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.IndexTests;\n\npublic class CreateCombinedTextIndexAsyncTests : TestKeyedMongoRepositoryContext<int>\n{\n    private readonly List<Expression<Func<TestDocumentWithKey<int>, object>>> keyedFieldExpressions = new() {t => t.SomeContent2, t => t.SomeContent3};\n\n    [Fact]\n    public async Task WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(keyedFieldExpressions);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpressions, null, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(keyedFieldExpressions, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpressions, null, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(keyedFieldExpressions, options);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpressions, options, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(keyedFieldExpressions, options, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpressions, options, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(keyedFieldExpressions, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpressions, null, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(keyedFieldExpressions, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpressions, null, partitionKey, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(keyedFieldExpressions, options, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpressions, options, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateCombinedTextIndexAsync(keyedFieldExpressions, options, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateCombinedTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpressions, options, partitionKey, token));\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/IndexTests/CreateDescendingIndexAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.Models;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.IndexTests;\n\npublic class CreateDescendingIndexAsyncTests : TestKeyedMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedFieldExpression = t => t.SomeContent2;\n\n    [Fact]\n    public async Task WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(keyedFieldExpression);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(keyedFieldExpression, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(keyedFieldExpression, options);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(keyedFieldExpression, options, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(keyedFieldExpression, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(keyedFieldExpression, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(keyedFieldExpression, options, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateDescendingIndexAsync(keyedFieldExpression, options, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, token));\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/IndexTests/CreateHashedIndexAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.Models;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.IndexTests;\n\npublic class CreateHashedIndexAsyncTests : TestKeyedMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedFieldExpression = t => t.SomeContent2;\n\n    [Fact]\n    public async Task WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(keyedFieldExpression);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(keyedFieldExpression, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(keyedFieldExpression, options);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(keyedFieldExpression, options, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(keyedFieldExpression, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(keyedFieldExpression, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(keyedFieldExpression, options, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateHashedIndexAsync(keyedFieldExpression, options, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateHashedIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, token));\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/IndexTests/CreateTextIndexAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.Models;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.IndexTests;\n\npublic class CreateTextIndexAsyncTests : TestKeyedMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedFieldExpression = t => t.SomeContent2;\n\n    [Fact]\n    public async Task WithFieldExpression_CreatesIndex()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(keyedFieldExpression);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(keyedFieldExpression, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptions_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(keyedFieldExpression, options);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(keyedFieldExpression, options, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, null, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(keyedFieldExpression, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(keyedFieldExpression, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, null, partitionKey, token));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(keyedFieldExpression, options, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var indexName = Fixture.Create<string>();\n        var options = new IndexCreationOptions { Name = indexName };\n\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.CreateTextIndexAsync(keyedFieldExpression, options, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.CreateTextIndexAsync<TestDocumentWithKey<int>, int>(\n                keyedFieldExpression, options, partitionKey, token));\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/IndexTests/DropIndexAsyncTests.cs",
    "content": "using System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.IndexTests;\n\npublic class DropIndexAsyncTests : TestKeyedMongoRepositoryContext<int>\n{\n    [Fact]\n    public async Task WitIndexName_DropsIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.DropIndexAsync<TestDocumentWithKey<int>>(indexName);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.DropIndexAsync<TestDocumentWithKey<int>, int>(indexName, null, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WitIndexNameAndCancellationToken_DropsIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.DropIndexAsync<TestDocumentWithKey<int>>(indexName, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.DropIndexAsync<TestDocumentWithKey<int>, int>(indexName, null, token));\n    }\n\n    [Fact]\n    public async Task WitIndexNameAndPartitionKey_DropsIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.DropIndexAsync<TestDocumentWithKey<int>>(indexName, partitionKey);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.DropIndexAsync<TestDocumentWithKey<int>, int>(indexName, partitionKey, CancellationToken.None));\n    }\n\n    [Fact]\n    public async Task WitIndexNameAndPartitionKeyAndCancellationToken_DropsIndex()\n    {\n        // Arrange\n        var indexName = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n\n        // Act\n        await Sut.DropIndexAsync<TestDocumentWithKey<int>>(indexName, partitionKey, token);\n\n        // Assert\n        IndexHandler.Verify(\n            x => x.DropIndexAsync<TestDocumentWithKey<int>, int>(indexName, partitionKey, token));\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/IndexTests/GetIndexNamesAsyncTests.cs",
    "content": "using System.Collections.Generic;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.IndexTests;\n\npublic class GetIndexNamesAsyncTests : TestKeyedMongoRepositoryContext<int>\n{\n    [Fact]\n    public async Task WithNoParameters_ReturnsIndexNames()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n        var indexName = Fixture.Create<string>();\n\n        IndexHandler\n            .Setup(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new List<string> { indexName });\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocumentWithKey<int>>();\n\n        // Assert\n        Assert.NotNull(result);\n        Assert.Contains(result, x => x == indexName);\n        IndexHandler.Verify(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(null, CancellationToken.None), Times.Once());\n    }\n\n    [Fact]\n    public async Task WithCancellationToken_ReturnsIndexNames()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n        var indexName = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        IndexHandler\n            .Setup(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new List<string> { indexName });\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocumentWithKey<int>>(token);\n\n        // Assert\n        Assert.NotNull(result);\n        Assert.Contains(result, x => x == indexName);\n        IndexHandler.Verify(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(null, token), Times.Once());\n    }\n\n    [Fact]\n    public async Task WithPartitionKey_ReturnsIndexNames()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n        var indexName = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n\n        IndexHandler\n            .Setup(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new List<string> { indexName });\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocumentWithKey<int>>(partitionKey);\n\n        // Assert\n        Assert.NotNull(result);\n        Assert.Contains(result, x => x == indexName);\n        IndexHandler.Verify(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(partitionKey, CancellationToken.None), Times.Once());\n    }\n\n    [Fact]\n    public async Task WithPartitionKeyAndCancellationToken_ReturnsIndexNames()\n    {\n        // Arrange\n        IndexHandler = new Mock<IMongoDbIndexHandler>();\n        var indexName = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        IndexHandler\n            .Setup(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(It.IsAny<string>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(new List<string> { indexName });\n\n        // Act\n        var result = await Sut.GetIndexesNamesAsync<TestDocumentWithKey<int>>(partitionKey, token);\n\n        // Assert\n        Assert.NotNull(result);\n        Assert.Contains(result, x => x == indexName);\n        IndexHandler.Verify(x => x.GetIndexesNamesAsync<TestDocumentWithKey<int>, int>(partitionKey, token), Times.Once());\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/UpdateTests/UpdateManyAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.UpdateTests;\n\npublic class UpdateManyAsyncTests : TestKeyedMongoRepositoryContext<int>\n{\n    private readonly UpdateDefinition<TestDocumentWithKey<int>> updateDefinition = Builders<TestDocumentWithKey<int>>.Update.Set(x => x.SomeContent, \"Updated\");\n    private readonly Expression<Func<TestDocumentWithKey<int>, string>> fieldExpression = x => x.SomeContent;\n    private readonly FilterDefinition<TestDocumentWithKey<int>> filterDefinition = Builders<TestDocumentWithKey<int>>.Filter.Eq(x => x.Id, 1);\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filterExpression = x => x.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, updateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                filterExpression,\n                updateDefinition,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndUpdateDefinitionAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, updateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                filterExpression,\n                updateDefinition,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndUpdateDefinitionAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, updateDefinition, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                filterExpression,\n                updateDefinition,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndUpdateDefinitionAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterExpression, updateDefinition, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                filterExpression,\n                updateDefinition,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, updateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                filterDefinition,\n                updateDefinition,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndUpdateDefinitionCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, updateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                filterDefinition,\n                updateDefinition,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndUpdateDefinitionAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, updateDefinition, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                filterDefinition,\n                updateDefinition,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndUpdateDefinitionAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n\n        // Act\n        var result = await Sut.UpdateManyAsync(filterDefinition, updateDefinition, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateManyAsync<TestDocumentWithKey<int>, int>(\n                filterDefinition,\n                updateDefinition,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/UpdateTests/UpdateManyTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.UpdateTests;\n\npublic class UpdateManyTests : TestKeyedMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, string>> fieldExpression = x => x.SomeContent;\n    private readonly FilterDefinition<TestDocumentWithKey<int>> filterDefinition = Builders<TestDocumentWithKey<int>>.Filter.Eq(x => x.Id, 1);\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filterExpression = x => x.SomeContent == \"SomeContent\";\n    private readonly UpdateDefinition<TestDocumentWithKey<int>> updateDefinition = Builders<TestDocumentWithKey<int>>.Update.Set(x => x.SomeContent, \"Updated\");\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var count = Fixture.Create<long>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, updateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                filterExpression,\n                updateDefinition,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndUpdateDefinitionAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, updateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                filterExpression,\n                updateDefinition,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndUpdateDefinitionAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, updateDefinition, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                filterExpression,\n                updateDefinition,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndUpdateDefinitionAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterExpression, updateDefinition, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                filterExpression,\n                updateDefinition,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, updateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                filterDefinition,\n                updateDefinition,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndUpdateDefinitionCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, updateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                filterDefinition,\n                updateDefinition,\n                null,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndUpdateDefinitionAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, updateDefinition, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                filterDefinition,\n                updateDefinition,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndUpdateDefinitionAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n\n        // Act\n        var result = Sut.UpdateMany(filterDefinition, updateDefinition, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateMany<TestDocumentWithKey<int>, int>(\n                filterDefinition,\n                updateDefinition,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().Be(count);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/UpdateTests/UpdateOneAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.UpdateTests;\n\npublic class UpdateOneAsyncTests : TestKeyedMongoRepositoryContext<int>\n{\n    private readonly UpdateDefinition<TestDocumentWithKey<int>> updateDefinition = Builders<TestDocumentWithKey<int>>.Update.Set(x => x.SomeContent, \"Updated\");\n    private readonly Expression<Func<TestDocumentWithKey<int>, string>> fieldExpression = x => x.SomeContent;\n    private readonly FilterDefinition<TestDocumentWithKey<int>> filterDefinition = Builders<TestDocumentWithKey<int>>.Filter.Eq(x => x.Id, 1);\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filterExpression = x => x.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public async Task WithDocument_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<TestDocumentWithKey<int>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(document);\n\n        // Assert\n        Updater.Verify(x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(document, CancellationToken.None), Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithDocumentAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(It.IsAny<TestDocumentWithKey<int>>(), It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(document, token);\n\n        // Assert\n        Updater.Verify(x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(document, token), Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithDocumentAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(document, updateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(\n                document,\n                updateDefinition,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithDocumentAndUpdateDefinitionAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(document, updateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int>(\n                document,\n                updateDefinition,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithDocumentAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(document, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                document,\n                fieldExpression,\n                value,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithDocumentAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(document, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                document,\n                fieldExpression,\n                value,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterDefinition, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterDefinition, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterDefinition, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterDefinition, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterExpression, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterExpression, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterExpression, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public async Task WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n\n        // Act\n        var result = await Sut.UpdateOneAsync(filterExpression, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOneAsync<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyTypedRepositoryTests/UpdateTests/UpdateOneTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyTypedRepositoryTests.UpdateTests;\n\npublic class UpdateOneTests : TestKeyedMongoRepositoryContext<int>\n{\n    private readonly UpdateDefinition<TestDocumentWithKey<int>> updateDefinition = Builders<TestDocumentWithKey<int>>.Update.Set(x => x.SomeContent, \"Updated\");\n    private readonly Expression<Func<TestDocumentWithKey<int>, string>> fieldExpression = x => x.SomeContent;\n    private readonly FilterDefinition<TestDocumentWithKey<int>> filterDefinition = Builders<TestDocumentWithKey<int>>.Filter.Eq(x => x.Id, 1);\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filterExpression = x => x.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public void WithDocument_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOne<TestDocumentWithKey<int>, int>(It.IsAny<TestDocumentWithKey<int>>(), It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(document);\n\n        // Assert\n        Updater.Verify(x => x.UpdateOne<TestDocumentWithKey<int>, int>(document, CancellationToken.None), Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithDocumentAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(x => x.UpdateOne<TestDocumentWithKey<int>, int>(It.IsAny<TestDocumentWithKey<int>>(), It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(document, token);\n\n        // Assert\n        Updater.Verify(x => x.UpdateOne<TestDocumentWithKey<int>, int>(document, token), Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithDocumentAndUpdateDefinition_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(document, updateDefinition);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int>(\n                document,\n                updateDefinition,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithDocumentAndUpdateDefinitionAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<UpdateDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(document, updateDefinition, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int>(\n                document,\n                updateDefinition,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithDocumentAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(document, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                document,\n                fieldExpression,\n                value,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithDocumentAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<TestDocumentWithKey<int>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(document, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                document,\n                fieldExpression,\n                value,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterDefinition, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterDefinition, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterDefinition, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterDefinitionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterDefinition, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                filterDefinition,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValue_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterExpression, fieldExpression, value);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterExpression, fieldExpression, value, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                null,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndPartitionKey_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterExpression, fieldExpression, value, partitionKey);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                CancellationToken.None),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n\n    [Fact]\n    public void WithFilterExpressionAndFieldExpressionAndValueAndPartitionKeyAndCancellationToken_ShouldUpdateOne()\n    {\n        // Arrange\n        var value = Fixture.Create<string>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Updater = new Mock<IMongoDbUpdater>();\n        Updater\n            .Setup(\n                x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, string>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n\n        // Act\n        var result = Sut.UpdateOne(filterExpression, fieldExpression, value, partitionKey, token);\n\n        // Assert\n        Updater.Verify(\n            x => x.UpdateOne<TestDocumentWithKey<int>, int, string>(\n                filterExpression,\n                fieldExpression,\n                value,\n                partitionKey,\n                token),\n            Times.Once);\n        result.Should().BeTrue();\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/AnyAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class AnyAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public async Task WithFilter_GetsResult()\n    {\n        // Arrange\n        SetupReader();\n\n        // Act\n        var result = await Sut.AnyAsync(filter);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n\n        SetupReader();\n\n        // Act\n        var result = await Sut.AnyAsync(filter, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(filter, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKey_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader();\n\n        // Act\n        var result = await Sut.AnyAsync(filter, partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKeyAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader();\n\n        // Act\n        var result = await Sut.AnyAsync(filter, partitionKey, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader()\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.AnyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/AnyTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class AnyTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public void WithFilter_GetsResult()\n    {\n        // Arrange\n        SetupReader();\n\n        // Act\n        var result = Sut.Any(filter);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n\n        SetupReader();\n\n        // Act\n        var result = Sut.Any(filter, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(filter, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKey_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader();\n\n        // Act\n        var result = Sut.Any(filter, partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKeyAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader();\n\n        // Act\n        var result = Sut.Any(filter, partitionKey, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(filter, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader()\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.Any<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/CountAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class CountAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public async Task WithFilter_GetsOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        SetupReader(count);\n\n        // Act\n        var result = await Sut.CountAsync(filter);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        SetupReader(count);\n\n        // Act\n        var result = await Sut.CountAsync(filter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(filter, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(count);\n\n        // Act\n        var result = await Sut.CountAsync(filter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(count);\n\n        // Act\n        var result = await Sut.CountAsync(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(long count)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.CountAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/CountTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class CountTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public void WithFilter_GetsOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        SetupReader(count);\n\n        // Act\n        var result = Sut.Count(filter);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        SetupReader(count);\n\n        // Act\n        var result = Sut.Count(filter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(filter, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(count);\n\n        // Act\n        var result = Sut.Count(filter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(count);\n\n        // Act\n        var result = Sut.Count(filter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(filter, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(long count)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.Count<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GetAllAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GetAllAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public async Task WithFilter_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetAllAsync(filter);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetAllAsync(filter, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(filter, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetAllAsync(filter, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetAllAsync(filter, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(List<TestDocumentWithKey<int>> documents)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetAllAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GetAllTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GetAllTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public void WithFilter_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetAll(filter);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetAll(filter, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(filter, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetAll(filter, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetAll(filter, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(filter, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(List<TestDocumentWithKey<int>> documents)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetAll<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GetByIdAsyncTests.cs",
    "content": "using System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GetByIdAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    [Fact]\n    public async Task WithId_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocumentWithKey<int>>(document.Id);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByIdAsync<TestDocumentWithKey<int>, int>(document.Id, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithIdAndCancellationToken_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocumentWithKey<int>>(document.Id, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByIdAsync<TestDocumentWithKey<int>, int>(document.Id, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithIdAndPartitionKey_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocumentWithKey<int>>(document.Id, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByIdAsync<TestDocumentWithKey<int>, int>(document.Id, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithIdAndPartitionKeyAndCancellationToken_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocumentWithKey<int>>(document.Id, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByIdAsync<TestDocumentWithKey<int>, int>(document.Id, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetByIdAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<int>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(document);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GetByIdTests.cs",
    "content": "using System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GetByIdTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    [Fact]\n    public void WithId_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetById<TestDocumentWithKey<int>>(document.Id);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetById<TestDocumentWithKey<int>, int>(document.Id, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithIdAndCancellationToken_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetById<TestDocumentWithKey<int>>(document.Id, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetById<TestDocumentWithKey<int>, int>(document.Id, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithIdAndPartitionKey_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetById<TestDocumentWithKey<int>>(document.Id, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetById<TestDocumentWithKey<int>, int>(document.Id, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithIdAndPartitionKeyAndCancellationToken_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetById<TestDocumentWithKey<int>>(document.Id, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetById<TestDocumentWithKey<int>, int>(document.Id, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetById<TestDocumentWithKey<int>, int>(\n                    It.IsAny<int>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(document);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GetByMaxAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GetByMaxAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> selector = document => document.SomeValue;\n\n    [Fact]\n    public async Task WithFilterAndSelector_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMaxAsync(filter, selector);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMaxAsync<TestDocumentWithKey<int>, int>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMaxAsync(filter, selector, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMaxAsync<TestDocumentWithKey<int>, int>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMaxAsync(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMaxAsync<TestDocumentWithKey<int>, int>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMaxAsync(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMaxAsync<TestDocumentWithKey<int>, int>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetByMaxAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, object>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(document);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GetByMaxTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GetByMaxTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> selector = document => document.SomeValue;\n\n    [Fact]\n    public void WithFilterAndSelector_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMax(filter, selector);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMax<TestDocumentWithKey<int>, int>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMax(filter, selector, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMax<TestDocumentWithKey<int>, int>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMax(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMax<TestDocumentWithKey<int>, int>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMax(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMax<TestDocumentWithKey<int>, int>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetByMax<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, object>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(document);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GetByMinAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GetByMinAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> selector = document => document.SomeValue;\n\n    [Fact]\n    public async Task WithFilterAndSelector_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMinAsync(filter, selector);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMinAsync<TestDocumentWithKey<int>, int>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMinAsync(filter, selector, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMinAsync<TestDocumentWithKey<int>, int>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMinAsync(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMinAsync<TestDocumentWithKey<int>, int>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMinAsync(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMinAsync<TestDocumentWithKey<int>, int>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetByMinAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, object>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(document);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GetByMinTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GetByMinTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> selector = document => document.SomeValue;\n\n    [Fact]\n    public void WithFilterAndSelector_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMin(filter, selector);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMin<TestDocumentWithKey<int>, int>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMin(filter, selector, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMin<TestDocumentWithKey<int>, int>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMin(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMin<TestDocumentWithKey<int>, int>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMin(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMin<TestDocumentWithKey<int>, int>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetByMin<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, object>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(document);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GetMaxValueAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GetMaxValueAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, int>> selector = document => document.SomeValue;\n\n    [Fact]\n    public async Task WithFilterAndSelector_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync(filter, selector);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValueAsync<TestDocumentWithKey<int>, int, int>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync(filter, selector, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValueAsync<TestDocumentWithKey<int>, int, int>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKey_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValueAsync<TestDocumentWithKey<int>, int, int>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValueAsync<TestDocumentWithKey<int>, int, int>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(int value)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetMaxValueAsync<TestDocumentWithKey<int>, int, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(value);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GetMaxValueTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GetMaxValueTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, int>> selector = document => document.SomeValue;\n\n    [Fact]\n    public void WithFilterAndSelector_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMaxValue(filter, selector);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValue<TestDocumentWithKey<int>, int, int>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMaxValue(filter, selector, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValue<TestDocumentWithKey<int>, int, int>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKey_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMaxValue(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValue<TestDocumentWithKey<int>, int, int>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMaxValue(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValue<TestDocumentWithKey<int>, int, int>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(int value)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetMaxValue<TestDocumentWithKey<int>, int, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(value);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GetMinValueAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GetMinValueAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, int>> selector = document => document.SomeValue;\n\n    [Fact]\n    public async Task WithFilterAndSelector_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMinValueAsync(filter, selector);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValueAsync<TestDocumentWithKey<int>, int, int>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMinValueAsync(filter, selector, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValueAsync<TestDocumentWithKey<int>, int, int>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKey_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMinValueAsync(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValueAsync<TestDocumentWithKey<int>, int, int>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMinValueAsync(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValueAsync<TestDocumentWithKey<int>, int, int>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(int value)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetMinValueAsync<TestDocumentWithKey<int>, int, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(value);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GetMinValueTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GetMinValueTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, int>> selector = document => document.SomeValue;\n\n    [Fact]\n    public void WithFilterAndSelector_GetsMinValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMinValue(filter, selector);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValue<TestDocumentWithKey<int>, int, int>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndCancellationToken_GetsMinValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMinValue(filter, selector, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValue<TestDocumentWithKey<int>, int, int>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKey_GetsMinValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMinValue(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValue<TestDocumentWithKey<int>, int, int>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMinValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMinValue(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValue<TestDocumentWithKey<int>, int, int>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(int value)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetMinValue<TestDocumentWithKey<int>, int, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(value);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GetOneAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GetOneAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public async Task WithFilter_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetOneAsync(filter);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetOneAsync(filter, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(filter, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetOneAsync(filter, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetOneAsync(filter, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(filter, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetOneAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(document);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GetOneTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GetOneTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public void WithFilter_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetOne(filter);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(filter, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetOne(filter, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(filter, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetOne(filter, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(filter, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetOne(filter, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(filter, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetOne<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(document);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GetSortedPaginatedAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GetSortedPaginatedAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.GroupingKey == 1;\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> selector = document => document.GroupingKey;\n    private readonly SortDefinition<TestDocumentWithKey<int>> sortDefinition = Builders<TestDocumentWithKey<int>>.Sort.Ascending(document => document.GroupingKey);\n\n    private const bool DefaultAscending = true;\n    private const int DefaultSkipNumber = 0;\n    private const int DefaultTakeNumber = 50;\n\n    [Fact]\n    public async Task WithFilterAndSortSelector_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortSelector();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, selector);\n\n        // Assert\n        VerifySelector(result, documents, DefaultAscending, DefaultSkipNumber, DefaultTakeNumber, null, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortSelectorAndAscending_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortSelector();\n        var ascending = Fixture.Create<bool>();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, selector, ascending);\n\n        // Assert\n        VerifySelector(result, documents, ascending, DefaultSkipNumber, DefaultTakeNumber, null, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortSelectorAndSkipNumber_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortSelector();\n        var skipNumber = Fixture.Create<int>();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, selector, skipNumber: skipNumber);\n\n        // Assert\n        VerifySelector(result, documents, DefaultAscending, skipNumber, DefaultTakeNumber, null, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortSelectorAndTakeNumber_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortSelector();\n        var ascending = Fixture.Create<bool>();\n        var takeNumber = Fixture.Create<int>();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, selector, ascending, takeNumber: takeNumber);\n\n        // Assert\n        VerifySelector(result, documents, ascending, DefaultSkipNumber, takeNumber, null, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortSelectorAndPartitionKey_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortSelector();\n        var partitionKey = Fixture.Create<string>();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, selector, partitionKey: partitionKey);\n\n        // Assert\n        VerifySelector(result, documents, DefaultAscending, DefaultSkipNumber, DefaultTakeNumber, partitionKey, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortSelectorAndCancellationToken_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortSelector();\n        var cancellationToken = new CancellationToken(true);\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, selector, cancellationToken: cancellationToken);\n\n        // Assert\n        VerifySelector(result, documents, DefaultAscending, DefaultSkipNumber, DefaultTakeNumber, null, cancellationToken);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortDefinition_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortDefinition();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, sortDefinition);\n\n        // Assert\n        VerifyDefinition(result, documents, DefaultSkipNumber, DefaultTakeNumber, null, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortDefinitionAndSkipNumber_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortDefinition();\n        var skipNumber = Fixture.Create<int>();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, sortDefinition, skipNumber);\n\n        // Assert\n        VerifyDefinition(result, documents, skipNumber, DefaultTakeNumber, null, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortDefinitionAndTakeNumber_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortDefinition();\n        var takeNumber = Fixture.Create<int>();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, sortDefinition, takeNumber: takeNumber);\n\n        // Assert\n        VerifyDefinition(result, documents, DefaultSkipNumber, takeNumber, null, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortDefinitionAndPartitionKey_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortDefinition();\n        var partitionKey = Fixture.Create<string>();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, sortDefinition, partitionKey: partitionKey);\n\n        // Assert\n        VerifyDefinition(result, documents, DefaultSkipNumber, DefaultTakeNumber, partitionKey, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortDefinitionAndCancellationToken_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortDefinition();\n        var token = new CancellationToken(true);\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, sortDefinition, cancellationToken: token);\n\n        // Assert\n        VerifyDefinition(result, documents, DefaultSkipNumber, DefaultTakeNumber, null, token);\n    }\n\n    private List<TestDocumentWithKey<int>> SetupReaderWithSortSelector()\n    {\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GetSortedPaginatedAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, object>>>(),\n                    It.IsAny<bool>(),\n                    It.IsAny<int>(),\n                    It.IsAny<int>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents);\n        return documents;\n    }\n\n    private void VerifySelector(List<TestDocumentWithKey<int>> result, List<TestDocumentWithKey<int>> documents, bool ascending, int skipNumber, int takeNumber, string partitionKey, CancellationToken cancellationToken)\n    {\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(documents);\n        Reader.Verify(\n            x => x.GetSortedPaginatedAsync<TestDocumentWithKey<int>, int>(\n                filter,\n                selector,\n                ascending,\n                skipNumber,\n                takeNumber,\n                partitionKey,\n                cancellationToken),\n            Times.Once);\n    }\n\n    private List<TestDocumentWithKey<int>> SetupReaderWithSortDefinition()\n    {\n        var documents = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GetSortedPaginatedAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<SortDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<int>(),\n                    It.IsAny<int>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents);\n        return documents;\n    }\n\n    private void VerifyDefinition(List<TestDocumentWithKey<int>> result, List<TestDocumentWithKey<int>> documents, int skipNumber, int takeNumber, string partitionKey, CancellationToken cancellationToken)\n    {\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(documents);\n        Reader.Verify(\n            x => x.GetSortedPaginatedAsync<TestDocumentWithKey<int>, int>(\n                filter,\n                sortDefinition,\n                skipNumber,\n                takeNumber,\n                partitionKey,\n                cancellationToken),\n            Times.Once);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/GroupByTests.cs",
    "content": "using System;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class GroupByTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, int>> grouping = document => document.GroupingKey;\n    private readonly Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>> projection = documents => new TestProjection {Count = documents.Count()};\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.GroupingKey == 1;\n\n    [Fact]\n    public void WithGroupingCriteriaAndProjection_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(grouping, projection);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(grouping, projection, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithGroupingCriteriaAndProjectionAndCancellationToken_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(true);\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader\n            .Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(grouping, projection, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(grouping, projection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithGroupingCriteriaAndProjectionAndPartitionKey_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader\n            .Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(grouping, projection, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(grouping, projection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithGroupingCriteriaAndProjectionAndPartitionKeyAndCancellationToken_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader\n            .Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(grouping, projection, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(grouping, projection, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndGroupingCriteriaAndProjection_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>,bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(filter, grouping, projection);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(filter, grouping, projection, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndGroupingCriteriaAndProjectionAndCancellationToken_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(true);\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>,bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(filter, grouping, projection, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(filter, grouping, projection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndGroupingCriteriaAndProjectionAndPartitionKey_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>,bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(filter, grouping, projection, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(filter, grouping, projection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndGroupingCriteriaAndProjectionAndPartitionKeyAndCancellationToken_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>,bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(filter, grouping, projection, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(filter, grouping, projection, partitionKey, token),\n            Times.Once);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/ProjectManyAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class ProjectManyAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, TestProjection>> projection = document => new TestProjection {NestedData = document.Nested.SomeDate};\n\n    [Fact]\n    public async Task WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n\n        SetupReader(projections);\n\n        // Act\n        var result = await Sut.ProjectManyAsync(filter, projection);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(\n                filter,\n                projection,\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(true);\n\n        SetupReader(projections);\n\n        // Act\n        var result = await Sut.ProjectManyAsync(filter, projection, token);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(filter, projection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(projections);\n\n        // Act\n        var result = await Sut.ProjectManyAsync(filter, projection, partitionKey);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(filter, projection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(projections);\n\n        // Act\n        var result = await Sut.ProjectManyAsync(filter, projection, partitionKey, token);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(filter, projection, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(List<TestProjection> projections)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(projections);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/ProjectManyTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class ProjectManyTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, TestProjection>> projection = document => new TestProjection {NestedData = document.Nested.SomeDate};\n\n    [Fact]\n    public void WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n\n        SetupReader(projections);\n\n        // Act\n        var result = Sut.ProjectMany(filter, projection);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectMany<TestDocumentWithKey<int>, TestProjection, int>(\n                filter,\n                projection,\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(true);\n\n        SetupReader(projections);\n\n        // Act\n        var result = Sut.ProjectMany(filter, projection, token);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectMany<TestDocumentWithKey<int>, TestProjection, int>(filter, projection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(projections);\n\n        // Act\n        var result = Sut.ProjectMany(filter, projection, partitionKey);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectMany<TestDocumentWithKey<int>, TestProjection, int>(filter, projection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(projections);\n\n        // Act\n        var result = Sut.ProjectMany(filter, projection, partitionKey, token);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectMany<TestDocumentWithKey<int>, TestProjection, int>(filter, projection, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(List<TestProjection> projections)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.ProjectMany<TestDocumentWithKey<int>, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/ProjectOneAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class ProjectOneAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, TestProjection>> projection = document => new TestProjection {NestedData = document.Nested.SomeDate};\n\n    [Fact]\n    public async Task WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n\n        SetupReader(expected);\n\n        // Act\n        var result = await Sut.ProjectOneAsync(filter, projection);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOneAsync<TestDocumentWithKey<int>, TestProjection, int>(\n                filter,\n                projection,\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var token = new CancellationToken(true);\n\n        SetupReader(expected);\n\n        // Act\n        var result = await Sut.ProjectOneAsync(filter, projection, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOneAsync<TestDocumentWithKey<int>, TestProjection, int>(filter, projection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(expected);\n\n        // Act\n        var result = await Sut.ProjectOneAsync(filter, projection, partitionKey);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOneAsync<TestDocumentWithKey<int>, TestProjection, int>(filter, projection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(expected);\n\n        // Act\n        var result = await Sut.ProjectOneAsync(filter, projection, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOneAsync<TestDocumentWithKey<int>, TestProjection, int>(filter, projection, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestProjection result)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.ProjectOneAsync<TestDocumentWithKey<int>, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(result);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/ProjectOneTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class ProjectOneTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, TestProjection>> projection = document => new TestProjection {NestedData = document.Nested.SomeDate};\n\n    [Fact]\n    public void WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n\n        SetupReader(expected);\n\n        // Act\n        var result = Sut.ProjectOne(filter, projection);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOne<TestDocumentWithKey<int>, TestProjection, int>(\n                filter,\n                projection,\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var token = new CancellationToken(true);\n\n        SetupReader(expected);\n\n        // Act\n        var result = Sut.ProjectOne(filter, projection, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOne<TestDocumentWithKey<int>, TestProjection, int>(filter, projection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(expected);\n\n        // Act\n        var result = Sut.ProjectOne(filter, projection, partitionKey);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOne<TestDocumentWithKey<int>, TestProjection, int>(filter, projection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(expected);\n\n        // Act\n        var result = Sut.ProjectOne(filter, projection, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOne<TestDocumentWithKey<int>, TestProjection, int>(filter, projection, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestProjection result)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.ProjectOne<TestDocumentWithKey<int>, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(result);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/KeyedReadOnlyMongoRepositoryTests/SumByAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;\n\npublic class SumByAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<int>\n{\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, int>> intSelector = document => document.SomeValue;\n    private readonly Expression<Func<TestDocumentWithKey<int>, decimal>> decimalSelector = document => document.SomeDecimalValue;\n\n    [Fact]\n    public async Task Int_WithFilterAndSelector_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<int>();\n\n        SetupReaderInt(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, intSelector);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(filter, intSelector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Int_WithFilterAndSelectorAndCancellationToken_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<int>();\n        var token = new CancellationToken(true);\n\n        SetupReaderInt(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, intSelector, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(filter, intSelector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Int_WithFilterAndSelectorAndPartitionKey_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReaderInt(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, intSelector, partitionKey);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(filter, intSelector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Int_WithFilterAndSelectorAndPartitionKeyAndCancellationToken_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReaderInt(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, intSelector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(filter, intSelector, partitionKey, token),\n            Times.Once);\n    }\n\n        [Fact]\n    public async Task Decimal_WithFilterAndSelector_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<decimal>();\n\n        SetupReaderDecimal(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, decimalSelector);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(filter, decimalSelector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Decimal_WithFilterAndSelectorAndCancellationToken_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<decimal>();\n        var token = new CancellationToken(true);\n\n        SetupReaderDecimal(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, decimalSelector, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(filter, decimalSelector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Decimal_WithFilterAndSelectorAndPartitionKey_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<decimal>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReaderDecimal(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, decimalSelector, partitionKey);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(filter, decimalSelector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Decimal_WithFilterAndSelectorAndPartitionKeyAndCancellationToken_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<decimal>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReaderDecimal(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, decimalSelector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(filter, decimalSelector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReaderInt(int expected)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.SumByAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>,int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(expected);\n    }\n\n    private void SetupReaderDecimal(decimal expected)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.SumByAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, decimal>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(expected);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/AnyAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class AnyAsyncTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> expression = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedExpression = document => document.SomeContent == \"SomeContent\";\n    private readonly FilterDefinition<TestDocumentWithKey<int>> keyedFilter = Builders<TestDocumentWithKey<int>>.Filter.Eq(x => x.Id, 1);\n\n    [Fact]\n    public async Task WithExpression_GetsResult()\n    {\n        // Arrange\n        SetupReader();\n\n        // Act\n        var result = await Sut.AnyAsync(expression);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocument, Guid>(expression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithExpressionAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n\n        SetupReader();\n\n        // Act\n        var result = await Sut.AnyAsync(expression, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocument, Guid>(expression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithExpressionAndPartitionKey_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader();\n\n        // Act\n        var result = await Sut.AnyAsync(expression, partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocument, Guid>(expression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithExpressionAndPartitionKeyAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader();\n\n        // Act\n        var result = await Sut.AnyAsync(expression, partitionKey, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocument, Guid>(expression, partitionKey, token),\n            Times.Once);\n    }\n\n    #region keyed\n\n    [Fact]\n    public async Task Keyed_WithExpression_GetsResult()\n    {\n        // Arrange\n        SetupKeyedReaderWithExpression();\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocumentWithKey<int>, int>(keyedExpression);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(keyedExpression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithExpressionAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithExpression();\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocumentWithKey<int>, int>(keyedExpression, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(keyedExpression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithExpressionAndPartitionKey_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReaderWithExpression();\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithExpressionAndPartitionKeyAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithExpression();\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilter_GetsResult()\n    {\n        // Arrange\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter, null, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndOptions_GetsResult()\n    {\n        // Arrange\n        var options = new CountOptions();\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter, options);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter, null, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndOptionsAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n        var options = new CountOptions();\n\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndPartitionKey_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter, null, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndCountOptionsAndPartitionKey_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var options = new CountOptions();\n\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n    [Fact]\n    public async Task Keyed_WithFilterAndPartitionKeyAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter, null, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndCountOptionsAndPartitionKeyAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var options = new CountOptions();\n\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = await Sut.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.AnyAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReaderWithExpression()\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.AnyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n    }\n\n    private void SetupKeyedReaderWithFilter()\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.AnyAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n    }\n\n    #endregion\n\n    private void SetupReader()\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.AnyAsync<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(true);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/AnyTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class AnyTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> expression = document => document.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public void WithExpression_GetsResult()\n    {\n        // Arrange\n        SetupReader();\n\n        // Act\n        var result = Sut.Any(expression);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocument, Guid>(expression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithExpressionAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n\n        SetupReader();\n\n        // Act\n        var result = Sut.Any(expression, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocument, Guid>(expression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithExpressionAndPartitionKey_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader();\n\n        // Act\n        var result = Sut.Any(expression, partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocument, Guid>(expression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithExpressionAndPartitionKeyAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader();\n\n        // Act\n        var result = Sut.Any(expression, partitionKey, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocument, Guid>(expression, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader()\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.Any<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedExpression = document => document.SomeContent == \"SomeContent\";\n    private readonly FilterDefinition<TestDocumentWithKey<int>> keyedFilter = Builders<TestDocumentWithKey<int>>.Filter.Eq(document => document.SomeContent, \"SomeContent\");\n\n    [Fact]\n    public void Keyed_WithExpression_GetsResult()\n    {\n        // Arrange\n        SetupKeyedReaderWithExpression();\n\n        // Act\n        var result = Sut.Any<TestDocumentWithKey<int>, int>(keyedExpression);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(keyedExpression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithExpressionAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithExpression();\n\n        // Act\n        var result = Sut.Any<TestDocumentWithKey<int>, int>(keyedExpression, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(keyedExpression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithExpressionAndPartitionKey_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReaderWithExpression();\n\n        // Act\n        var result = Sut.Any<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithExpressionAndPartitionKeyAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithExpression();\n\n        // Act\n        var result = Sut.Any<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilter_GetsResult()\n    {\n        // Arrange\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = Sut.Any<TestDocumentWithKey<int>, int>(keyedFilter);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(keyedFilter, null, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = Sut.Any<TestDocumentWithKey<int>, int>(keyedFilter, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(keyedFilter, null, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndOptions_GetsResult()\n    {\n        // Arrange\n        var options = new CountOptions();\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = Sut.Any<TestDocumentWithKey<int>, int>(keyedFilter, options);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(keyedFilter, options, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndOptionsAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var options = new CountOptions();\n        var token = new CancellationToken(true);\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = Sut.Any<TestDocumentWithKey<int>, int>(keyedFilter, options, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(keyedFilter, options, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndPartitionKey_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = Sut.Any<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(keyedFilter, null, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndOptionsAndPartitionKey_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var options = new CountOptions();\n\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = Sut.Any<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndPartitionKeyAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = Sut.Any<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(keyedFilter, null, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndOptionsAndPartitionKeyAndCancellationToken_GetsResult()\n    {\n        // Arrange\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var options = new CountOptions();\n\n        SetupKeyedReaderWithFilter();\n\n        // Act\n        var result = Sut.Any<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, token);\n\n        // Assert\n        result.Should().BeTrue();\n        Reader.Verify(\n            x => x.Any<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReaderWithExpression()\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.Any<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n    }\n\n    private void SetupKeyedReaderWithFilter()\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.Any<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(true);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/CountAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class CountAsyncTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> expression = document => document.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public async Task WithExpression_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        SetupReader(count);\n\n        // Act\n        var result = await Sut.CountAsync(expression);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocument, Guid>(expression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithExpressionAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        SetupReader(count);\n\n        // Act\n        var result = await Sut.CountAsync(expression, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocument, Guid>(expression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithExpressionAndPartitionKey_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(count);\n\n        // Act\n        var result = await Sut.CountAsync(expression, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocument, Guid>(expression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithExpressionAndPartitionKeyAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(count);\n\n        // Act\n        var result = await Sut.CountAsync(expression, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocument, Guid>(expression, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(long count)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.CountAsync<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedExpression = document => document.SomeContent == \"SomeContent\";\n    private readonly FilterDefinition<TestDocumentWithKey<int>> keyedFilter = Builders<TestDocumentWithKey<int>>.Filter.Eq(document => document.Id, 1);\n\n    [Fact]\n    public async Task Keyed_WithExpression_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        SetupKeyedReaderWithExpression(count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocumentWithKey<int>, int>(keyedExpression);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(keyedExpression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithExpressionAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithExpression(count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocumentWithKey<int>, int>(keyedExpression, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(keyedExpression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithExpressionAndPartitionKey_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReaderWithExpression(count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithExpressionAndPartitionKeyAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithExpression(count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilter_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter, null, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndCountOptions_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var countOptions = new CountOptions();\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter, countOptions);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter, countOptions, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter, null, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndCountOptionsAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n        var countOptions = new CountOptions();\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter, countOptions, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter, countOptions, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndPartitionKey_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter, null, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndCountOptionsAndPartitionKey_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var countOptions = new CountOptions();\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter, countOptions, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter, countOptions, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndPartitionKeyAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter, null, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndCountOptionsPartitionKeyAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var countOptions = new CountOptions();\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = await Sut.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter, countOptions, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.CountAsync<TestDocumentWithKey<int>, int>(keyedFilter, countOptions, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReaderWithExpression(long count)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.CountAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n    }\n\n    private void SetupKeyedReaderWithFilter(long count)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.CountAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(count);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/CountTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class CountTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> expression = document => document.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public void WithExpression_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        SetupReader(count);\n\n        // Act\n        var result = Sut.Count(expression);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocument, Guid>(expression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithExpressionAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        SetupReader(count);\n\n        // Act\n        var result = Sut.Count(expression, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocument, Guid>(expression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithExpressionAndPartitionKey_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(count);\n\n        // Act\n        var result = Sut.Count(expression, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocument, Guid>(expression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithExpressionAndPartitionKeyAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(count);\n\n        // Act\n        var result = Sut.Count(expression, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocument, Guid>(expression, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(long count)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.Count<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedExpression = document => document.SomeContent == \"SomeContent\";\n\n    private readonly FilterDefinition<TestDocumentWithKey<int>> keyedFilter = Builders<TestDocumentWithKey<int>>.Filter.Eq(\n        document => document.SomeContent,\n        \"SomeContent\");\n\n    [Fact]\n    public void Keyed_WithExpression_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        SetupKeyedReader(count);\n\n        // Act\n        var result = Sut.Count<TestDocumentWithKey<int>, int>(keyedExpression);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(keyedExpression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithExpressionAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(count);\n\n        // Act\n        var result = Sut.Count<TestDocumentWithKey<int>, int>(keyedExpression, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(keyedExpression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithExpressionAndPartitionKey_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReader(count);\n\n        // Act\n        var result = Sut.Count<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithExpressionAndPartitionKeyAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(count);\n\n        // Act\n        var result = Sut.Count<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReader(long count)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.Count<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilter_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = Sut.Count<TestDocumentWithKey<int>, int>(keyedFilter);\n\n        // Assert\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(keyedFilter, null, null, CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndCountOptions_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var countOptions = new CountOptions();\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = Sut.Count<TestDocumentWithKey<int>, int>(keyedFilter, countOptions);\n\n        // Assert\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(keyedFilter, countOptions, null, CancellationToken.None),\n            Times.Once);\n        result.Should().Be(count);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = Sut.Count<TestDocumentWithKey<int>, int>(keyedFilter, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(keyedFilter, null, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndCountOptionsAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var token = new CancellationToken(true);\n        var countOptions = new CountOptions();\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = Sut.Count<TestDocumentWithKey<int>, int>(keyedFilter, countOptions,  token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(keyedFilter, countOptions, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndPartitionKey_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = Sut.Count<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(keyedFilter, null, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndCountOptionsAndPartitionKey_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var countOptions = new CountOptions();\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = Sut.Count<TestDocumentWithKey<int>, int>(keyedFilter, countOptions, partitionKey);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(keyedFilter, countOptions, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndPartitionKeyAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = Sut.Count<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(keyedFilter, null, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndCountOptionsAndPartitionKeyAndCancellationToken_Counts()\n    {\n        // Arrange\n        var count = Fixture.Create<long>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var countOptions = new CountOptions();\n\n        SetupKeyedReaderWithFilter(count);\n\n        // Act\n        var result = Sut.Count<TestDocumentWithKey<int>, int>(keyedFilter, countOptions, partitionKey, token);\n\n        // Assert\n        result.Should().Be(count);\n        Reader.Verify(\n            x => x.Count<TestDocumentWithKey<int>, int>(keyedFilter, countOptions, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReaderWithFilter(long count)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.Count<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<CountOptions>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(count);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GetAllAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GetAllAsyncTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> expression = document => document.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public async Task WithExpression_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocument>().ToList();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetAllAsync(expression);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocument, Guid>(expression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithExpressionAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetAllAsync(expression, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocument, Guid>(expression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithExpressionAndPartitionKey_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetAllAsync(expression, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocument, Guid>(expression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithExpressionAndPartitionKeyAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetAllAsync(expression, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocument, Guid>(expression, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(List<TestDocument> documents)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetAllAsync<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedExpression = document => document.SomeContent == \"SomeContent\";\n    private readonly FilterDefinition<TestDocumentWithKey<int>> keyedFilter = Builders<TestDocumentWithKey<int>>.Filter.Eq(document => document.SomeContent, \"SomeContent\");\n\n    [Fact]\n    public async Task Keyed_WithExpression_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocumentWithKey<int>, int>(keyedExpression);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(keyedExpression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithExpressionAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocumentWithKey<int>, int>(keyedExpression, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(keyedExpression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithExpressionAndPartitionKey_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithExpressionAndPartitionKeyAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilter_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n\n        SetupReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter, null, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndOptions_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var options = new FindOptions();\n\n        SetupReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter, options);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var token = new CancellationToken(true);\n\n        SetupReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter, null, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndFindOptionsAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var token = new CancellationToken(true);\n        var options = new FindOptions();\n\n        SetupReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndPartitionKey_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter, null, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndFindOptionsAndPartitionKey_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var options = new FindOptions();\n\n        SetupReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndPartitionKeyAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter, null, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndFindOptionsAndPartitionKeyAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var options = new FindOptions();\n\n        SetupReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAllAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReaderWithFilter(List<TestDocumentWithKey<int>> documents)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetAllAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<FindOptions>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents);\n    }\n\n    private void SetupReader(List<TestDocumentWithKey<int>> documents)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetAllAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GetAllTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GetAllTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> expression = document => document.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public void WithExpression_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocument>().ToList();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetAll(expression);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocument, Guid>(expression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithExpressionAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocument>().ToList();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetAll(expression, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocument, Guid>(expression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithExpressionAndPartitionKey_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetAll(expression, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocument, Guid>(expression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithExpressionAndPartitionKeyAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocument>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetAll(expression, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocument, Guid>(expression, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(List<TestDocument> documents)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetAll<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedExpression = document => document.SomeContent == \"SomeContent\";\n    private readonly FilterDefinition<TestDocumentWithKey<int>> keyedFilter = Builders<TestDocumentWithKey<int>>.Filter.Eq(document => document.SomeContent, \"SomeContent\");\n\n    [Fact]\n    public void Keyed_WithExpression_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = Sut.GetAll<TestDocumentWithKey<int>, int>(keyedExpression);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(keyedExpression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithExpressionAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = Sut.GetAll<TestDocumentWithKey<int>, int>(keyedExpression, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(keyedExpression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithExpressionAndPartitionKey_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = Sut.GetAll<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithExpressionAndPartitionKeyAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = Sut.GetAll<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilter_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetAll<TestDocumentWithKey<int>, int>(keyedFilter);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(keyedFilter, null, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndFindOptions_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var options = new FindOptions();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetAll<TestDocumentWithKey<int>, int>(keyedFilter, options);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(keyedFilter, options, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetAll<TestDocumentWithKey<int>, int>(keyedFilter, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(keyedFilter, null, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndFindOptionsAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var token = new CancellationToken(true);\n        var options = new FindOptions();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetAll<TestDocumentWithKey<int>, int>(keyedFilter, options, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(keyedFilter, options, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndPartitionKey_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetAll<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(keyedFilter, null, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndFindOptionsAndPartitionKey_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var options = new FindOptions();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetAll<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndPartitionKeyAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetAll<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(keyedFilter, null, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndFindOptionsAndPartitionKeyAndCancellationToken_GetsAll()\n    {\n        // Arrange\n        var document = Fixture.CreateMany<TestDocumentWithKey<int>>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var options = new FindOptions();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetAll<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetAll<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReaderWithFilter(List<TestDocumentWithKey<int>> documents)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetAll<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<FindOptions>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents);\n    }\n\n    private void SetupKeyedReader(List<TestDocumentWithKey<int>> documents)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetAll<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(documents);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GetByIdAsyncTests.cs",
    "content": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GetByIdAsyncTests : TestReadOnlyMongoRepositoryContext\n{\n    [Fact]\n    public async Task WithId_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocument>(document.Id);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByIdAsync<TestDocument, Guid>(document.Id, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithIdAndCancellationToken_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocument>(document.Id, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByIdAsync<TestDocument, Guid>(document.Id, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithIdAndPartitionKey_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocument>(document.Id, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByIdAsync<TestDocument, Guid>(document.Id, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithIdAndPartitionKeyAndCancellationToken_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocument>(document.Id, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByIdAsync<TestDocument, Guid>(document.Id, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocument document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetByIdAsync<TestDocument, Guid>(\n                    It.IsAny<Guid>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(document);\n    }\n\n    #region Keyed\n\n    [Fact]\n    public async Task Keyed_WithId_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocumentWithKey<int>, int>(document.Id);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByIdAsync<TestDocumentWithKey<int>, int>(document.Id, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithIdAndCancellationToken_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocumentWithKey<int>, int>(document.Id, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByIdAsync<TestDocumentWithKey<int>, int>(document.Id, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithIdAndPartitionKey_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocumentWithKey<int>, int>(document.Id, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByIdAsync<TestDocumentWithKey<int>, int>(document.Id, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithIdAndPartitionKeyAndCancellationToken_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = await Sut.GetByIdAsync<TestDocumentWithKey<int>, int>(document.Id, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByIdAsync<TestDocumentWithKey<int>, int>(document.Id, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetByIdAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<int>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(document);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GetByIdTests.cs",
    "content": "using System;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GetByIdTests : TestReadOnlyMongoRepositoryContext\n{\n    [Fact]\n    public void WithId_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetById<TestDocument>(document.Id);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetById<TestDocument, Guid>(document.Id, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithIdAndCancellationToken_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetById<TestDocument>(document.Id, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetById<TestDocument, Guid>(document.Id, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithIdAndPartitionKey_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetById<TestDocument>(document.Id, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetById<TestDocument, Guid>(document.Id, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithIdAndPartitionKeyAndCancellationToken_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetById<TestDocument>(document.Id, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetById<TestDocument, Guid>(document.Id, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocument document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetById<TestDocument, Guid>(\n                    It.IsAny<Guid>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(document);\n    }\n\n    #region Keyed\n\n    [Fact]\n    public void Keyed_WithId_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = Sut.GetById<TestDocumentWithKey<int>, int>(document.Id);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetById<TestDocumentWithKey<int>, int>(document.Id, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithIdAndCancellationToken_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = Sut.GetById<TestDocumentWithKey<int>, int>(document.Id, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetById<TestDocumentWithKey<int>, int>(document.Id, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithIdAndPartitionKey_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = Sut.GetById<TestDocumentWithKey<int>, int>(document.Id, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetById<TestDocumentWithKey<int>, int>(document.Id, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithIdAndPartitionKeyAndCancellationToken_Gets()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = Sut.GetById<TestDocumentWithKey<int>, int>(document.Id, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetById<TestDocumentWithKey<int>, int>(document.Id, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetById<TestDocumentWithKey<int>, int>(\n                    It.IsAny<int>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(document);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GetByMaxAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GetByMaxAsyncTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, object>> selector = document => document.SomeValue;\n\n    [Fact]\n    public async Task WithFilterAndSelector_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMaxAsync(filter, selector);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMaxAsync<TestDocument, Guid>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMaxAsync(filter, selector, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMaxAsync<TestDocument, Guid>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMaxAsync(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMaxAsync<TestDocument, Guid>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMaxAsync(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMaxAsync<TestDocument, Guid>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocument document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetByMaxAsync<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, object>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(document);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedSelector = document => document.SomeValue;\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelector_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMaxAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMaxAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelectorAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMaxAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMaxAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelectorAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMaxAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMaxAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMaxAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMaxAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetByMaxAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, object>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(document);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GetByMaxTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GetByMaxTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, object>> selector = document => document.SomeValue;\n\n    [Fact]\n    public void WithFilterAndSelector_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMax(filter, selector);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMax<TestDocument, Guid>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMax(filter, selector, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMax<TestDocument, Guid>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMax(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMax<TestDocument, Guid>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMax(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMax<TestDocument, Guid>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocument document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetByMax<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, object>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(document);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedSelector = document => document.SomeValue;\n\n    [Fact]\n    public void Keyed_WithFilterAndSelector_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMax<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMax<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndSelectorAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMax<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMax<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndSelectorAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMax<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMax<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMax<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMax<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetByMax<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, object>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(document);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GetByMinAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GetByMinAsyncTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, object>> selector = document => document.SomeValue;\n\n    [Fact]\n    public async Task WithFilterAndSelector_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMinAsync(filter, selector);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMinAsync<TestDocument, Guid>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMinAsync(filter, selector, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMinAsync<TestDocument, Guid>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMinAsync(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMinAsync<TestDocument, Guid>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetByMinAsync(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMinAsync<TestDocument, Guid>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocument document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetByMinAsync<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, object>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(document);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedSelector = document => document.SomeValue;\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelector_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = await Sut.GetByMinAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMinAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelectorAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = await Sut.GetByMinAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMinAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelectorAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = await Sut.GetByMinAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMinAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = await Sut.GetByMinAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMinAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetByMinAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, object>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(document);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GetByMinTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GetByMinTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, object>> selector = document => document.SomeValue;\n\n    [Fact]\n    public void WithFilterAndSelector_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMin(filter, selector);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMin<TestDocument, Guid>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMin(filter, selector, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMin<TestDocument, Guid>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMin(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMin<TestDocument, Guid>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMin(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMin<TestDocument, Guid>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocument document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetByMin<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, object>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(document);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedSelector = document => document.SomeValue;\n\n    [Fact]\n    public void Keyed_WithFilterAndSelector_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMin<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMin<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndSelectorAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMin<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMin<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndSelectorAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMin<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMin<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetByMin<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetByMin<TestDocumentWithKey<int>, int>(keyedFilter, keyedSelector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetByMin<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, object>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(document);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GetMaxValueAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GetMaxValueAsyncTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, int>> selector = document => document.SomeValue;\n\n    [Fact]\n    public async Task WithFilterAndSelector_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync(filter, selector);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValueAsync<TestDocument, Guid, int>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync(filter, selector, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValueAsync<TestDocument, Guid, int>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKey_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValueAsync<TestDocument, Guid, int>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValueAsync<TestDocument, Guid, int>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(int value)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetMaxValueAsync<TestDocument, Guid, int>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(value);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, int>> keyedSelector = document => document.SomeValue;\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelector_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelectorAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelectorAndPartitionKey_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = await Sut.GetMaxValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReader(int value)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetMaxValueAsync<TestDocumentWithKey<int>, int, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(value);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GetMaxValueTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GetMaxValueTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, int>> selector = document => document.SomeValue;\n\n    [Fact]\n    public void WithFilterAndSelector_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMaxValue(filter, selector);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValue<TestDocument, Guid, int>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMaxValue(filter, selector, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValue<TestDocument, Guid, int>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKey_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMaxValue(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValue<TestDocument, Guid, int>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMaxValue(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValue<TestDocument, Guid, int>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(int value)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetMaxValue<TestDocument, Guid, int>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(value);\n    }\n\n    #region Keyed\n\n        private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, int>> keyedSelector = document => document.SomeValue;\n\n    [Fact]\n    public void Keyed_WithFilterAndSelector_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = Sut.GetMaxValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndSelectorAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = Sut.GetMaxValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndSelectorAndPartitionKey_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = Sut.GetMaxValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = Sut.GetMaxValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMaxValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReader(int value)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetMaxValue<TestDocumentWithKey<int>, int, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(value);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GetMinValueAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GetMinValueAsyncTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, int>> selector = document => document.SomeValue;\n\n    [Fact]\n    public async Task WithFilterAndSelector_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMinValueAsync(filter, selector);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValueAsync<TestDocument, Guid, int>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMinValueAsync(filter, selector, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValueAsync<TestDocument, Guid, int>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKey_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMinValueAsync(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValueAsync<TestDocument, Guid, int>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = await Sut.GetMinValueAsync(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValueAsync<TestDocument, Guid, int>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(int value)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetMinValueAsync<TestDocument, Guid, int>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(value);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, int>> keyedSelector = document => document.SomeValue;\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelector_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = await Sut.GetMinValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelectorAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = await Sut.GetMinValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelectorAndPartitionKey_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = await Sut.GetMinValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMaxValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = await Sut.GetMinValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValueAsync<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReader(int value)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetMinValueAsync<TestDocumentWithKey<int>, int, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(value);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GetMinValueTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GetMinValueTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, int>> selector = document => document.SomeValue;\n\n    [Fact]\n    public void WithFilterAndSelector_GetsMinValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMinValue(filter, selector);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValue<TestDocument, Guid, int>(filter, selector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndCancellationToken_GetsMinValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMinValue(filter, selector, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValue<TestDocument, Guid, int>(filter, selector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKey_GetsMinValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMinValue(filter, selector, partitionKey);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValue<TestDocument, Guid, int>(filter, selector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMinValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(value);\n\n        // Act\n        var result = Sut.GetMinValue(filter, selector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValue<TestDocument, Guid, int>(filter, selector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(int value)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetMinValue<TestDocument, Guid, int>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(value);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, int>> keyedSelector = document => document.SomeValue;\n\n    [Fact]\n    public void Keyed_WithFilterAndSelector_GetsMinValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = Sut.GetMinValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndSelectorAndCancellationToken_GetsMinValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = Sut.GetMinValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndSelectorAndPartitionKey_GetsMinValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = Sut.GetMinValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndSelectorAndPartitionKeyAndCancellationToken_GetsMinValue()\n    {\n        // Arrange\n        var value = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(value);\n\n        // Act\n        var result = Sut.GetMinValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(value);\n        Reader.Verify(\n            x => x.GetMinValue<TestDocumentWithKey<int>, int, int>(keyedFilter, keyedSelector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReader(int value)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetMinValue<TestDocumentWithKey<int>, int, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(value);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GetOneAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GetOneAsyncTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> expression = document => document.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public async Task WithExpression_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetOneAsync(expression);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocument, Guid>(expression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithExpressionAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetOneAsync(expression, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocument, Guid>(expression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithExpressionAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetOneAsync(expression, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocument, Guid>(expression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithExpressionAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetOneAsync(expression, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocument, Guid>(expression, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocument document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetOneAsync<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(document);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedExpression = document => document.SomeContent == \"SomeContent\";\n    private readonly FilterDefinition<TestDocumentWithKey<int>> keyedFilter = Builders<TestDocumentWithKey<int>>.Filter.Eq(document => document.SomeContent, \"SomeContent\");\n\n    [Fact]\n    public async Task Keyed_WithExpression_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocumentWithKey<int>, int>(keyedExpression);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(keyedExpression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithExpressionAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocumentWithKey<int>, int>(keyedExpression, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(keyedExpression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithExpressionAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithExpressionAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilter_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter, null, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndFindOptions_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var options = new FindOptions();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter, options);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter, null, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndFindOptionsAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        var options = new FindOptions();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter,null, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndFindOptionsAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var options = new FindOptions();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter,options, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter,null, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndFindOptionsAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var options = new FindOptions();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = await Sut.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOneAsync<TestDocumentWithKey<int>, int>(keyedFilter,options, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReaderWithFilter(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetOneAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<FindOptions>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(document);\n    }\n\n    private void SetupReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetOneAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(document);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GetOneTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GetOneTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> expression = document => document.SomeContent == \"SomeContent\";\n\n    [Fact]\n    public void WithExpression_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetOne(expression);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocument, Guid>(expression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithExpressionAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetOne(expression, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocument, Guid>(expression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithExpressionAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetOne(expression, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocument, Guid>(expression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithExpressionAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocument>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(document);\n\n        // Act\n        var result = Sut.GetOne(expression, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocument, Guid>(expression, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestDocument document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetOne<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(document);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedExpression = document => document.SomeContent == \"SomeContent\";\n    private readonly FilterDefinition<TestDocumentWithKey<int>> keyedFilter = Builders<TestDocumentWithKey<int>>.Filter.Eq(document => document.SomeContent, \"SomeContent\");\n\n    [Fact]\n    public void Keyed_WithExpression_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = Sut.GetOne<TestDocumentWithKey<int>, int>(keyedExpression);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(keyedExpression, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithExpressionAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = Sut.GetOne<TestDocumentWithKey<int>, int>(keyedExpression, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(keyedExpression, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithExpressionAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = Sut.GetOne<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithExpressionAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(document);\n\n        // Act\n        var result = Sut.GetOne<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(keyedExpression, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilter_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetOne<TestDocumentWithKey<int>, int>(keyedFilter);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(keyedFilter, null, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndFindOptions_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var options = new FindOptions();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetOne<TestDocumentWithKey<int>, int>(keyedFilter, options);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(keyedFilter, options, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetOne<TestDocumentWithKey<int>, int>(keyedFilter, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(keyedFilter, null, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndFindOptionsAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var token = new CancellationToken(true);\n        var options = new FindOptions();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetOne<TestDocumentWithKey<int>, int>(keyedFilter, options, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(keyedFilter, options, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetOne<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(keyedFilter, null, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndFindOptionsAndPartitionKey_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var options = new FindOptions();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetOne<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetOne<TestDocumentWithKey<int>, int>(keyedFilter, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(keyedFilter, null, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndFindOptionsAndPartitionKeyAndCancellationToken_GetsOne()\n    {\n        // Arrange\n        var document = Fixture.Create<TestDocumentWithKey<int>>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        var options = new FindOptions();\n\n        SetupKeyedReaderWithFilter(document);\n\n        // Act\n        var result = Sut.GetOne<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(document);\n        Reader.Verify(\n            x => x.GetOne<TestDocumentWithKey<int>, int>(keyedFilter, options, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReader(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetOne<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(document);\n    }\n\n    private void SetupKeyedReaderWithFilter(TestDocumentWithKey<int> document)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.GetOne<TestDocumentWithKey<int>, int>(\n                    It.IsAny<FilterDefinition<TestDocumentWithKey<int>>>(),\n                    It.IsAny<FindOptions>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(document);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GetSortedPaginatedAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GetSortedPaginatedAsyncTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = document => document.GroupingKey == 1;\n    private readonly Expression<Func<TestDocument, object>> selector = document => document.GroupingKey;\n    private readonly SortDefinition<TestDocument> sortDefinition = Builders<TestDocument>.Sort.Ascending(document => document.GroupingKey);\n\n    private const bool DefaultAscending = true;\n    private const int DefaultSkipNumber = 0;\n    private const int DefaultTakeNumber = 50;\n\n    [Fact]\n    public async Task WithFilterAndSortSelector_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortSelector();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, selector);\n\n        // Assert\n        VerifySelector(result, documents, DefaultAscending, DefaultSkipNumber, DefaultTakeNumber, null, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortSelectorAndAscending_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortSelector();\n        var ascending = Fixture.Create<bool>();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, selector, ascending);\n\n        // Assert\n        VerifySelector(result, documents, ascending, DefaultSkipNumber, DefaultTakeNumber, null, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortSelectorAndSkipNumber_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortSelector();\n        var skipNumber = Fixture.Create<int>();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, selector, skipNumber: skipNumber);\n\n        // Assert\n        VerifySelector(result, documents, DefaultAscending, skipNumber, DefaultTakeNumber, null, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortSelectorAndTakeNumber_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortSelector();\n        var ascending = Fixture.Create<bool>();\n        var takeNumber = Fixture.Create<int>();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, selector, ascending, takeNumber: takeNumber);\n\n        // Assert\n        VerifySelector(result, documents, ascending, DefaultSkipNumber, takeNumber, null, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortSelectorAndPartitionKey_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortSelector();\n        var partitionKey = Fixture.Create<string>();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, selector, partitionKey: partitionKey);\n\n        // Assert\n        VerifySelector(result, documents, DefaultAscending, DefaultSkipNumber, DefaultTakeNumber, partitionKey, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortSelectorAndCancellationToken_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortSelector();\n        var cancellationToken = new CancellationToken(true);\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, selector, cancellationToken: cancellationToken);\n\n        // Assert\n        VerifySelector(result, documents, DefaultAscending, DefaultSkipNumber, DefaultTakeNumber, null, cancellationToken);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortDefinition_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortDefinition();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, sortDefinition);\n\n        // Assert\n        VerifyDefinition(result, documents, DefaultSkipNumber, DefaultTakeNumber, null, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortDefinitionAndSkipNumber_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortDefinition();\n        var skipNumber = Fixture.Create<int>();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, sortDefinition, skipNumber);\n\n        // Assert\n        VerifyDefinition(result, documents, skipNumber, DefaultTakeNumber, null, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortDefinitionAndTakeNumber_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortDefinition();\n        var takeNumber = Fixture.Create<int>();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, sortDefinition, takeNumber: takeNumber);\n\n        // Assert\n        VerifyDefinition(result, documents, DefaultSkipNumber, takeNumber, null, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortDefinitionAndPartitionKey_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortDefinition();\n        var partitionKey = Fixture.Create<string>();\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, sortDefinition, partitionKey: partitionKey);\n\n        // Assert\n        VerifyDefinition(result, documents, DefaultSkipNumber, DefaultTakeNumber, partitionKey, CancellationToken.None);\n    }\n\n    [Fact]\n    public async Task WithFilterAndSortDefinitionAndCancellationToken_GetsResults()\n    {\n        // Arrange\n        var documents = SetupReaderWithSortDefinition();\n        var token = new CancellationToken(true);\n\n        // Act\n        var result = await Sut.GetSortedPaginatedAsync(filter, sortDefinition, cancellationToken: token);\n\n        // Assert\n        VerifyDefinition(result, documents, DefaultSkipNumber, DefaultTakeNumber, null, token);\n    }\n\n    private List<TestDocument> SetupReaderWithSortSelector()\n    {\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GetSortedPaginatedAsync<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, object>>>(),\n                    It.IsAny<bool>(),\n                    It.IsAny<int>(),\n                    It.IsAny<int>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents);\n        return documents;\n    }\n\n    private void VerifySelector(List<TestDocument> result, List<TestDocument> documents, bool ascending, int skipNumber, int takeNumber, string partitionKey, CancellationToken cancellationToken)\n    {\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(documents);\n        Reader.Verify(\n            x => x.GetSortedPaginatedAsync<TestDocument, Guid>(\n                filter,\n                selector,\n                ascending,\n                skipNumber,\n                takeNumber,\n                partitionKey,\n                cancellationToken),\n            Times.Once);\n    }\n\n    private List<TestDocument> SetupReaderWithSortDefinition()\n    {\n        var documents = Fixture.CreateMany<TestDocument>().ToList();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GetSortedPaginatedAsync<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<SortDefinition<TestDocument>>(),\n                    It.IsAny<int>(),\n                    It.IsAny<int>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(documents);\n        return documents;\n    }\n\n    private void VerifyDefinition(List<TestDocument> result, List<TestDocument> documents, int skipNumber, int takeNumber, string partitionKey, CancellationToken cancellationToken)\n    {\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(documents);\n        Reader.Verify(\n            x => x.GetSortedPaginatedAsync<TestDocument, Guid>(\n                filter,\n                sortDefinition,\n                skipNumber,\n                takeNumber,\n                partitionKey,\n                cancellationToken),\n            Times.Once);\n    }\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/GroupByTests.cs",
    "content": "using System;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class GroupByTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, int>> grouping = document => document.GroupingKey;\n    private readonly Expression<Func<IGrouping<int, TestDocument>, TestProjection>> projection = documents => new TestProjection {Count = documents.Count()};\n    private readonly Expression<Func<TestDocument, bool>> filter = document => document.GroupingKey == 1;\n\n    [Fact]\n    public void WithGroupingCriteriaAndProjection_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GroupBy<TestDocument, int, TestProjection, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocument>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(grouping, projection);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocument, int, TestProjection, Guid>(grouping, projection, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithGroupingCriteriaAndProjectionAndCancellationToken_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(true);\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader\n            .Setup(\n                x => x.GroupBy<TestDocument, int, TestProjection, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocument>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(grouping, projection, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocument, int, TestProjection, Guid>(grouping, projection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithGroupingCriteriaAndProjectionAndPartitionKey_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader\n            .Setup(\n                x => x.GroupBy<TestDocument, int, TestProjection, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocument>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(grouping, projection, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocument, int, TestProjection, Guid>(grouping, projection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithGroupingCriteriaAndProjectionAndPartitionKeyAndCancellationToken_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader\n            .Setup(\n                x => x.GroupBy<TestDocument, int, TestProjection, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocument>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(grouping, projection, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocument, int, TestProjection, Guid>(grouping, projection, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndGroupingCriteriaAndProjection_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GroupBy<TestDocument, int, TestProjection, Guid>(\n                    It.IsAny<Expression<Func<TestDocument,bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocument>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(filter, grouping, projection);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocument, int, TestProjection, Guid>(filter, grouping, projection, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndGroupingCriteriaAndProjectionAndCancellationToken_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(true);\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GroupBy<TestDocument, int, TestProjection, Guid>(\n                    It.IsAny<Expression<Func<TestDocument,bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocument>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(filter, grouping, projection, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocument, int, TestProjection, Guid>(filter, grouping, projection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndGroupingCriteriaAndProjectionAndPartitionKey_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GroupBy<TestDocument, int, TestProjection, Guid>(\n                    It.IsAny<Expression<Func<TestDocument,bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocument>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(filter, grouping, projection, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocument, int, TestProjection, Guid>(filter, grouping, projection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndGroupingCriteriaAndProjectionAndPartitionKeyAndCancellationToken_Groups()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GroupBy<TestDocument, int, TestProjection, Guid>(\n                    It.IsAny<Expression<Func<TestDocument,bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocument>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n\n        // Act\n        var result = Sut.GroupBy(filter, grouping, projection, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(projections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocument, int, TestProjection, Guid>(filter, grouping, projection, partitionKey, token),\n            Times.Once);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, int>> keyedGrouping = document => document.GroupingKey;\n    private readonly Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>> keyedProjection = documents => new TestProjection {Count = documents.Count()};\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilter = document => document.GroupingKey == 1;\n\n    [Fact]\n    public void Keyed_WithGroupingCriteriaAndProjection_Groups()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(keyedProjections);\n\n        // Act\n        var result = Sut.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedGrouping, keyedProjection);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(keyedProjections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedGrouping, keyedProjection, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithGroupingCriteriaAndProjectionAndCancellationToken_Groups()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(true);\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader\n            .Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(keyedProjections);\n\n        // Act\n        var result = Sut.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedGrouping, keyedProjection, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(keyedProjections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedGrouping, keyedProjection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithGroupingCriteriaAndProjectionAndPartitionKey_Groups()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader\n            .Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(keyedProjections);\n\n        // Act\n        var result = Sut.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedGrouping, keyedProjection, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(keyedProjections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedGrouping, keyedProjection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithGroupingCriteriaAndProjectionAndPartitionKeyAndCancellationToken_Groups()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader\n            .Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(keyedProjections);\n\n        // Act\n        var result = Sut.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedGrouping, keyedProjection, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(keyedProjections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedGrouping, keyedProjection, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndGroupingCriteriaAndProjection_Groups()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>,bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(keyedProjections);\n\n        // Act\n        var result = Sut.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedFilter, keyedGrouping, keyedProjection);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(keyedProjections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedFilter, keyedGrouping, keyedProjection, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndGroupingCriteriaAndProjectionAndCancellationToken_Groups()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(true);\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>,bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(keyedProjections);\n\n        // Act\n        var result = Sut.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedFilter, keyedGrouping, keyedProjection, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(keyedProjections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedFilter, keyedGrouping, keyedProjection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndGroupingCriteriaAndProjectionAndPartitionKey_Groups()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>,bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(keyedProjections);\n\n        // Act\n        var result = Sut.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedFilter, keyedGrouping, keyedProjection, partitionKey);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(keyedProjections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedFilter, keyedGrouping, keyedProjection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndGroupingCriteriaAndProjectionAndPartitionKeyAndCancellationToken_Groups()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n        Reader = new Mock<IMongoDbReader>();\n\n        Reader.Setup(\n                x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>,bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),\n                    It.IsAny<Expression<Func<IGrouping<int, TestDocumentWithKey<int>>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(keyedProjections);\n\n        // Act\n        var result = Sut.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedFilter, keyedGrouping, keyedProjection, partitionKey, token);\n\n        // Assert\n        result.Should().NotBeNull();\n        result.Should().BeEquivalentTo(keyedProjections);\n        Reader.Verify(\n            x => x.GroupBy<TestDocumentWithKey<int>, int, TestProjection, int>(keyedFilter, keyedGrouping, keyedProjection, partitionKey, token),\n            Times.Once);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/ProjectManyAsyncTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class ProjectManyAsyncTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, TestProjection>> projection = document => new TestProjection {NestedData = document.Nested.SomeDate};\n\n    [Fact]\n    public async Task WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n\n        SetupReader(projections);\n\n        // Act\n        var result = await Sut.ProjectManyAsync(filter, projection);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectManyAsync<TestDocument, TestProjection, Guid>(\n                filter,\n                projection,\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(true);\n\n        SetupReader(projections);\n\n        // Act\n        var result = await Sut.ProjectManyAsync(filter, projection, token);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectManyAsync<TestDocument, TestProjection, Guid>(filter, projection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(projections);\n\n        // Act\n        var result = await Sut.ProjectManyAsync(filter, projection, partitionKey);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectManyAsync<TestDocument, TestProjection, Guid>(filter, projection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(projections);\n\n        // Act\n        var result = await Sut.ProjectManyAsync(filter, projection, partitionKey, token);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectManyAsync<TestDocument, TestProjection, Guid>(filter, projection, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(List<TestProjection> projections)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.ProjectManyAsync<TestDocument, TestProjection, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(projections);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, TestProjection>> keyedProjection = document => new TestProjection {NestedData = document.Nested.SomeDate};\n\n    [Fact]\n    public async Task Keyed_WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n\n        SetupKeyedReader(keyedProjections);\n\n        // Act\n        var result = await Sut.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection);\n\n        // Assert\n        result.Should().OnlyContain(x => keyedProjections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(\n                keyedFilter,\n                keyedProjection,\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(keyedProjections);\n\n        // Act\n        var result = await Sut.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, token);\n\n        // Assert\n        result.Should().OnlyContain(x => keyedProjections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReader(keyedProjections);\n\n        // Act\n        var result = await Sut.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey);\n\n        // Assert\n        result.Should().OnlyContain(x => keyedProjections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(keyedProjections);\n\n        // Act\n        var result = await Sut.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey, token);\n\n        // Assert\n        result.Should().OnlyContain(x => keyedProjections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReader(List<TestProjection> keyedProjections)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(keyedProjections);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/ProjectManyTests.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class ProjectManyTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, TestProjection>> projection = document => new TestProjection {NestedData = document.Nested.SomeDate};\n\n    [Fact]\n    public void WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n\n        SetupReader(projections);\n\n        // Act\n        var result = Sut.ProjectMany(filter, projection);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectMany<TestDocument, TestProjection, Guid>(\n                filter,\n                projection,\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(true);\n\n        SetupReader(projections);\n\n        // Act\n        var result = Sut.ProjectMany(filter, projection, token);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectMany<TestDocument, TestProjection, Guid>(filter, projection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(projections);\n\n        // Act\n        var result = Sut.ProjectMany(filter, projection, partitionKey);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectMany<TestDocument, TestProjection, Guid>(filter, projection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var projections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(projections);\n\n        // Act\n        var result = Sut.ProjectMany(filter, projection, partitionKey, token);\n\n        // Assert\n        result.Should().OnlyContain(x => projections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectMany<TestDocument, TestProjection, Guid>(filter, projection, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(List<TestProjection> projections)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.ProjectMany<TestDocument, TestProjection, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(projections);\n    }\n\n    #region Keyed\n\n        private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, TestProjection>> keyedProjection = document => new TestProjection {NestedData = document.Nested.SomeDate};\n\n    [Fact]\n    public void Keyed_WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n\n        SetupKeyedReader(keyedProjections);\n\n        // Act\n        var result = Sut.ProjectMany<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection);\n\n        // Assert\n        result.Should().OnlyContain(x => keyedProjections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectMany<TestDocumentWithKey<int>, TestProjection, int>(\n                keyedFilter,\n                keyedProjection,\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(keyedProjections);\n\n        // Act\n        var result = Sut.ProjectMany<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, token);\n\n        // Assert\n        result.Should().OnlyContain(x => keyedProjections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectMany<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReader(keyedProjections);\n\n        // Act\n        var result = Sut.ProjectMany<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey);\n\n        // Assert\n        result.Should().OnlyContain(x => keyedProjections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectMany<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var keyedProjections = Fixture.CreateMany<TestProjection>().ToList();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(keyedProjections);\n\n        // Act\n        var result = Sut.ProjectMany<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey, token);\n\n        // Assert\n        result.Should().OnlyContain(x => keyedProjections.Contains(x));\n        Reader.Verify(\n            x => x.ProjectMany<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReader(List<TestProjection> keyedProjections)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.ProjectMany<TestDocumentWithKey<int>, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(keyedProjections);\n    }\n\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/ProjectOneAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class ProjectOneAsyncTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, TestProjection>> projection = document => new TestProjection {NestedData = document.Nested.SomeDate};\n\n    [Fact]\n    public async Task WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n\n        SetupReader(expected);\n\n        // Act\n        var result = await Sut.ProjectOneAsync(filter, projection);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOneAsync<TestDocument, TestProjection, Guid>(\n                filter,\n                projection,\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var token = new CancellationToken(true);\n\n        SetupReader(expected);\n\n        // Act\n        var result = await Sut.ProjectOneAsync(filter, projection, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOneAsync<TestDocument, TestProjection, Guid>(filter, projection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(expected);\n\n        // Act\n        var result = await Sut.ProjectOneAsync(filter, projection, partitionKey);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOneAsync<TestDocument, TestProjection, Guid>(filter, projection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(expected);\n\n        // Act\n        var result = await Sut.ProjectOneAsync(filter, projection, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOneAsync<TestDocument, TestProjection, Guid>(filter, projection, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestProjection result)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.ProjectOneAsync<TestDocument, TestProjection, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(result);\n    }\n\n    #region keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, TestProjection>> keyedProjection = document => new TestProjection {NestedData = document.Nested.SomeDate};\n\n    [Fact]\n    public async Task Keyed_WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n\n        SetupKeyedReader(expected);\n\n        // Act\n        var result = await Sut.ProjectOneAsync<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOneAsync<TestDocumentWithKey<int>, TestProjection, int>(\n                keyedFilter,\n                keyedProjection,\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(expected);\n\n        // Act\n        var result = await Sut.ProjectOneAsync<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOneAsync<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReader(expected);\n\n        // Act\n        var result = await Sut.ProjectOneAsync<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOneAsync<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(expected);\n\n        // Act\n        var result = await Sut.ProjectOneAsync<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOneAsync<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReader(TestProjection result)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.ProjectOneAsync<TestDocumentWithKey<int>, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(result);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/ProjectOneTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class ProjectOneTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, TestProjection>> projection = document => new TestProjection {NestedData = document.Nested.SomeDate};\n\n    [Fact]\n    public void WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n\n        SetupReader(expected);\n\n        // Act\n        var result = Sut.ProjectOne(filter, projection);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOne<TestDocument, TestProjection, Guid>(\n                filter,\n                projection,\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var token = new CancellationToken(true);\n\n        SetupReader(expected);\n\n        // Act\n        var result = Sut.ProjectOne(filter, projection, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOne<TestDocument, TestProjection, Guid>(filter, projection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReader(expected);\n\n        // Act\n        var result = Sut.ProjectOne(filter, projection, partitionKey);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOne<TestDocument, TestProjection, Guid>(filter, projection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReader(expected);\n\n        // Act\n        var result = Sut.ProjectOne(filter, projection, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOne<TestDocument, TestProjection, Guid>(filter, projection, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReader(TestProjection result)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.ProjectOne<TestDocument, TestProjection, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(result);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, TestProjection>> keyedProjection = document => new TestProjection {NestedData = document.Nested.SomeDate};\n\n    [Fact]\n    public void Keyed_WithFilterAndProjection_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n\n        SetupKeyedReader(expected);\n\n        // Act\n        var result = Sut.ProjectOne<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOne<TestDocumentWithKey<int>, TestProjection, int>(\n                keyedFilter,\n                keyedProjection,\n                null,\n                CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndProjectionAndCancellationToken_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(expected);\n\n        // Act\n        var result = Sut.ProjectOne<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOne<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndProjectionAndPartitionKey_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReader(expected);\n\n        // Act\n        var result = Sut.ProjectOne<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOne<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public void Keyed_WithFilterAndProjectionAndPartitionKeyAndCancellationToken_Projects()\n    {\n        // Arrange\n        var expected = Fixture.Create<TestProjection>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReader(expected);\n\n        // Act\n        var result = Sut.ProjectOne<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.ProjectOne<TestDocumentWithKey<int>, TestProjection, int>(keyedFilter, keyedProjection, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReader(TestProjection result)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.ProjectOne<TestDocumentWithKey<int>, TestProjection, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, TestProjection>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .Returns(result);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "CoreUnitTests/ReadOnlyMongoRepositoryTests/SumByAsyncTests.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing AutoFixture;\nusing CoreUnitTests.Infrastructure;\nusing CoreUnitTests.Infrastructure.Model;\nusing FluentAssertions;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing Moq;\nusing Xunit;\n\nnamespace CoreUnitTests.ReadOnlyMongoRepositoryTests;\n\npublic class SumByAsyncTests : TestReadOnlyMongoRepositoryContext\n{\n    private readonly Expression<Func<TestDocument, decimal>> decimalSelector = document => document.SomeDecimalValue;\n    private readonly Expression<Func<TestDocument, bool>> filter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocument, int>> intSelector = document => document.SomeValue;\n\n    [Fact]\n    public async Task Int_WithFilterAndSelector_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<int>();\n\n        SetupReaderInt(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, intSelector);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocument, Guid>(filter, intSelector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Int_WithFilterAndSelectorAndCancellationToken_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<int>();\n        var token = new CancellationToken(true);\n\n        SetupReaderInt(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, intSelector, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocument, Guid>(filter, intSelector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Int_WithFilterAndSelectorAndPartitionKey_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReaderInt(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, intSelector, partitionKey);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocument, Guid>(filter, intSelector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Int_WithFilterAndSelectorAndPartitionKeyAndCancellationToken_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReaderInt(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, intSelector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocument, Guid>(filter, intSelector, partitionKey, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Decimal_WithFilterAndSelector_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<decimal>();\n\n        SetupReaderDecimal(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, decimalSelector);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocument, Guid>(filter, decimalSelector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Decimal_WithFilterAndSelectorAndCancellationToken_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<decimal>();\n        var token = new CancellationToken(true);\n\n        SetupReaderDecimal(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, decimalSelector, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocument, Guid>(filter, decimalSelector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Decimal_WithFilterAndSelectorAndPartitionKey_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<decimal>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupReaderDecimal(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, decimalSelector, partitionKey);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocument, Guid>(filter, decimalSelector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Decimal_WithFilterAndSelectorAndPartitionKeyAndCancellationToken_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<decimal>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupReaderDecimal(expected);\n\n        // Act\n        var result = await Sut.SumByAsync(filter, decimalSelector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocument, Guid>(filter, decimalSelector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupReaderInt(int expected)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.SumByAsync<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(expected);\n    }\n\n    private void SetupReaderDecimal(decimal expected)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.SumByAsync<TestDocument, Guid>(\n                    It.IsAny<Expression<Func<TestDocument, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocument, decimal>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(expected);\n    }\n\n    #region Keyed\n\n    private readonly Expression<Func<TestDocumentWithKey<int>, bool>> keyedFilter = document => document.SomeContent == \"SomeContent\";\n    private readonly Expression<Func<TestDocumentWithKey<int>, int>> keyedIntSelector = document => document.SomeValue;\n    private readonly Expression<Func<TestDocumentWithKey<int>, decimal>> keyedDecimalSelector = document => document.SomeDecimalValue;\n\n    [Fact]\n    public async Task Keyed_Int_WithFilterAndSelector_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<int>();\n\n        SetupKeyedReaderInt(expected);\n\n        // Act\n        var result = await Sut.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedIntSelector);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedIntSelector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_Int_WithFilterAndSelectorAndCancellationToken_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<int>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderInt(expected);\n\n        // Act\n        var result = await Sut.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedIntSelector, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedIntSelector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_Int_WithFilterAndSelectorAndPartitionKey_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReaderInt(expected);\n\n        // Act\n        var result = await Sut.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedIntSelector, partitionKey);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedIntSelector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_Int_WithFilterAndSelectorAndPartitionKeyAndCancellationToken_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<int>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderInt(expected);\n\n        // Act\n        var result = await Sut.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedIntSelector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedIntSelector, partitionKey, token),\n            Times.Once);\n    }\n\n        [Fact]\n    public async Task Keyed_Decimal_WithFilterAndSelector_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<decimal>();\n\n        SetupKeyedReaderDecimal(expected);\n\n        // Act\n        var result = await Sut.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedDecimalSelector);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedDecimalSelector, null, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_Decimal_WithFilterAndSelectorAndCancellationToken_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<decimal>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderDecimal(expected);\n\n        // Act\n        var result = await Sut.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedDecimalSelector, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedDecimalSelector, null, token),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_Decimal_WithFilterAndSelectorAndPartitionKey_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<decimal>();\n        var partitionKey = Fixture.Create<string>();\n\n        SetupKeyedReaderDecimal(expected);\n\n        // Act\n        var result = await Sut.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedDecimalSelector, partitionKey);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedDecimalSelector, partitionKey, CancellationToken.None),\n            Times.Once);\n    }\n\n    [Fact]\n    public async Task Keyed_Decimal_WithFilterAndSelectorAndPartitionKeyAndCancellationToken_Sums()\n    {\n        // Arrange\n        var expected = Fixture.Create<decimal>();\n        var partitionKey = Fixture.Create<string>();\n        var token = new CancellationToken(true);\n\n        SetupKeyedReaderDecimal(expected);\n\n        // Act\n        var result = await Sut.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedDecimalSelector, partitionKey, token);\n\n        // Assert\n        result.Should().Be(expected);\n        Reader.Verify(\n            x => x.SumByAsync<TestDocumentWithKey<int>, int>(keyedFilter, keyedDecimalSelector, partitionKey, token),\n            Times.Once);\n    }\n\n    private void SetupKeyedReaderInt(int expected)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.SumByAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>,int>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(expected);\n    }\n\n    private void SetupKeyedReaderDecimal(decimal expected)\n    {\n        Reader = new Mock<IMongoDbReader>();\n        Reader\n            .Setup(\n                x => x.SumByAsync<TestDocumentWithKey<int>, int>(\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),\n                    It.IsAny<Expression<Func<TestDocumentWithKey<int>, decimal>>>(),\n                    It.IsAny<string>(),\n                    It.IsAny<CancellationToken>()))\n            .ReturnsAsync(expected);\n    }\n\n    #endregion\n}\n"
  },
  {
    "path": "IntegrationTests/App.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  For more information on how to configure your ASP.NET application, please visit\n  http://go.microsoft.com/fwlink/?LinkId=169433\n  -->\n<configuration>\n  <connectionStrings>\n    <add name=\"MongoDbTests\" connectionString=\"mongodb://localhost:27017\" />\n  </connectionStrings>\n  <runtime>\n    <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">\n      <dependentAssembly>\n        <assemblyIdentity name=\"System.Runtime.CompilerServices.Unsafe\" publicKeyToken=\"b03f5f7f11d50a3a\" culture=\"neutral\" />\n        <bindingRedirect oldVersion=\"0.0.0.0-5.0.0.0\" newVersion=\"5.0.0.0\" />\n      </dependentAssembly>\n      <dependentAssembly>\n        <assemblyIdentity name=\"System.Memory\" publicKeyToken=\"cc7b13ffcd2ddd51\" culture=\"neutral\" />\n        <bindingRedirect oldVersion=\"0.0.0.0-4.0.1.2\" newVersion=\"4.0.1.2\" />\n      </dependentAssembly>\n      <dependentAssembly>\n        <assemblyIdentity name=\"System.Buffers\" publicKeyToken=\"cc7b13ffcd2ddd51\" culture=\"neutral\" />\n        <bindingRedirect oldVersion=\"0.0.0.0-4.0.3.0\" newVersion=\"4.0.3.0\" />\n      </dependentAssembly>\n    </assemblyBinding>\n  </runtime>\n</configuration>"
  },
  {
    "path": "IntegrationTests/CRUDObjectIdTests.cs",
    "content": "﻿using IntegrationTests.Infrastructure;\nusing MongoDB.Bson;\nusing NUnit.Framework;\n\nnamespace IntegrationTests\n{\n    public class ObjectIdTestDocument : TestDoc<ObjectId>\n    {\n    }\n\n    [TestFixture]\n    public class CRUDObjectIdTests : MongoDbTKeyDocumentTestBase<ObjectIdTestDocument, ObjectId>\n    {\n        public override string GetClassName()\n        {\n            return \"CRUDObjectIdTests\";\n        }\n    }\n}\n"
  },
  {
    "path": "IntegrationTests/CRUDPartitionedCollectionNameAttributeTests.cs",
    "content": "﻿using IntegrationTests.Infrastructure;\nusing MongoDB.Bson.Serialization.Attributes;\nusing MongoDbGenericRepository.Attributes;\nusing MongoDbGenericRepository.Models;\nusing System;\n\nnamespace IntegrationTests\n{\n    [CollectionName(\"TestingCollectionNameAttributePartitionedTKey\")]\n    public class PartitionedCollectionNameDoc : TestDoc, IPartitionedDocument\n    {\n        public PartitionedCollectionNameDoc()\n        {\n            PartitionKey = \"TestPartitionKey\";\n        }\n\n        public string PartitionKey { get; set; }\n    }\n\n    public class CRUDPartitionedCollectionNameAttributeTests : MongoDbDocumentTestBase<PartitionedCollectionNameDoc>\n    {\n        public override string GetClassName()\n        {\n            return \"CRUDPartitionedCollectionNameAttributeTests\";\n        }\n    }\n}\n"
  },
  {
    "path": "IntegrationTests/CRUDPartitionedTests.cs",
    "content": "﻿using IntegrationTests.Infrastructure;\nusing MongoDbGenericRepository.Models;\n\nnamespace IntegrationTests\n{\n    public class PartitionedDoc : TestDoc, IPartitionedDocument\n    {\n        public PartitionedDoc()\n        {\n            PartitionKey = \"TestPartitionKey\";\n        }\n\n        public string PartitionKey { get; set; }\n    }\n\n    public class CRUDPartitionedTests : MongoDbDocumentTestBase<PartitionedDoc>\n    {\n        public override string GetClassName()\n        {\n            return \"CRUDPartitionedCollectionNameAttributeTests\";\n        }\n    }\n}\n"
  },
  {
    "path": "IntegrationTests/CRUDTKeyPartitionedCollectionNameAttributeTests.cs",
    "content": "﻿using IntegrationTests.Infrastructure;\nusing MongoDbGenericRepository.Attributes;\nusing MongoDbGenericRepository.Models;\nusing System;\n\nnamespace IntegrationTests\n{\n    [CollectionName(\"TestingCollectionNameAttributePartitionedTKey\")]\n    public class TKeyPartitionedCollectionNameDoc : TestDoc<Guid>, IPartitionedDocument\n    {\n        public TKeyPartitionedCollectionNameDoc()\n        {\n            PartitionKey = \"TestPartitionKey\";\n        }\n\n        public string PartitionKey { get; set; }\n    }\n\n    public class CRUDTKeyPartitionedCollectionNameAttributeTests : MongoDbTKeyDocumentTestBase<TKeyPartitionedCollectionNameDoc, Guid>\n    {\n        public override string GetClassName()\n        {\n            return \"CRUDTKeyPartitionedCollectionNameAttributeTests\";\n        }\n    }\n}\n"
  },
  {
    "path": "IntegrationTests/CRUDTKeyPartitionedTests.cs",
    "content": "﻿using IntegrationTests.Infrastructure;\nusing MongoDB.Bson.Serialization.Attributes;\nusing MongoDbGenericRepository.Models;\nusing NUnit.Framework;\nusing System;\n\nnamespace IntegrationTests\n{\n    public class PartitionedTKeyTestDocument : TestDoc<Guid>, IPartitionedDocument\n    {\n        public PartitionedTKeyTestDocument()\n        {\n            PartitionKey = \"TestPartitionKey\";\n        }\n        public string PartitionKey { get; set; }\n    }\n\n    [TestFixture]\n    public class CRUDTKeyPartitionedTests : MongoDbTKeyDocumentTestBase<PartitionedTKeyTestDocument, Guid>\n    {\n        public override string GetClassName()\n        {\n            return \"CRUDTKeyPartitionedTests\";\n        }\n    }\n}\n"
  },
  {
    "path": "IntegrationTests/CRUDTKeyTests.cs",
    "content": "﻿using IntegrationTests.Infrastructure;\nusing MongoDB.Bson.Serialization.Attributes;\nusing MongoDbGenericRepository.Models;\nusing NUnit.Framework;\nusing System;\n\nnamespace IntegrationTests\n{\n    public class TKeyTestDocument : TestDoc<Guid>\n    {\n    }\n\n    [TestFixture]\n    public class CRUDTKeyTests : MongoDbTKeyDocumentTestBase<TKeyTestDocument, Guid>\n    {\n        public override string GetClassName()\n        {\n            return \"CreateTKeyTests\";\n        }\n    }\n}\n"
  },
  {
    "path": "IntegrationTests/CRUDTests.cs",
    "content": "﻿using IntegrationTests.Infrastructure;\nusing NUnit.Framework;\n\nnamespace IntegrationTests\n{\n    public class TestDocument : TestDoc\n    {\n    }\n\n    [TestFixture]\n    public class CRUDTests : MongoDbDocumentTestBase<TestDocument>\n    {\n        public override string GetClassName()\n        {\n            return \"CRUDTests\";\n        }\n    }\n}\n"
  },
  {
    "path": "IntegrationTests/Infrastructure/BaseMongoDbRepositoryTests.cs",
    "content": "﻿using MongoDbGenericRepository.Models;\nusing NUnit.Framework;\nusing System.Collections.Generic;\nusing System.Configuration;\n\nnamespace IntegrationTests.Infrastructure\n{\n    public class BaseMongoDbRepositoryTests<T> where T : class, new()\n    {\n        public T CreateTestDocument()\n        {\n            return new T();\n        }\n\n        public List<T> CreateTestDocuments(int numberOfDocumentsToCreate)\n        {\n            var docs = new List<T>();\n            for(var i = 0; i < numberOfDocumentsToCreate; i++)\n            {\n                docs.Add(new T());\n            }\n            return docs;\n        }\n\n        public BaseMongoDbRepositoryTests()\n        {\n            var type = CreateTestDocument();\n            if (type is IPartitionedDocument)\n            {\n                PartitionKey = ((IPartitionedDocument)type).PartitionKey;\n            }\n        }\n\n        public string PartitionKey { get; set; }\n\n        /// <summary>\n        /// SUT: System Under Test\n        /// </summary>\n        protected static ITestRepository SUT { get; set; }\n\n        [OneTimeSetUp]\n        public void Init()\n        {\n            var connectionString = ConfigurationManager.ConnectionStrings[\"MongoDbTests\"].ConnectionString;\n            SUT = new TestRepository(connectionString, \"MongoDbTests\");\n        }\n\n        [OneTimeTearDown]\n        public void Cleanup()\n        {\n            // We drop the collection at the end of each test session.\n            if (!string.IsNullOrEmpty(PartitionKey))\n            {\n                SUT.DropTestCollection<T>(PartitionKey);\n            }\n            else\n            {\n                SUT.DropTestCollection<T>();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "IntegrationTests/Infrastructure/GlobalVariables.cs",
    "content": "﻿using System;\n\nnamespace IntegrationTests.Infrastructure\n{\n    /// <summary>\n    /// A class holding global variables.\n    /// </summary>\n    public static class GlobalVariables\n    {\n        /// <summary>\n        /// A random number generator.\n        /// </summary>\n        public static Random Random = new Random();\n    }\n}\n"
  },
  {
    "path": "IntegrationTests/Infrastructure/ITestRepository.cs",
    "content": "﻿using MongoDbGenericRepository;\n\nnamespace IntegrationTests\n{\n    public interface ITestRepository : IBaseMongoRepository\n    {\n        void DropTestCollection<TDocument>();\n        void DropTestCollection<TDocument>(string partitionKey);\n    }\n}"
  },
  {
    "path": "IntegrationTests/Infrastructure/MongoDBDocumentTestBase.cs",
    "content": "﻿using MongoDbGenericRepository.Models;\nusing NUnit.Framework;\nusing System;\nusing System.Collections.Generic;\nusing System.Configuration;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Threading.Tasks;\n\nnamespace IntegrationTests.Infrastructure\n{\n    [TestFixture]\n    public abstract class MongoDbDocumentTestBase<T> \n        where T: TestDoc, new()\n    {\n        public T CreateTestDocument()\n        {\n            return new T();\n        }\n\n        public abstract string GetClassName();\n\n        public List<T> CreateTestDocuments(int numberOfDocumentsToCreate)\n        {\n            var docs = new List<T>();\n            for (var i = 0; i < numberOfDocumentsToCreate; i++)\n            {\n                docs.Add(new T());\n            }\n            return docs;\n        }\n\n        /// <summary>\n        /// The partition key for the collection, if any\n        /// </summary>\n        protected string PartitionKey { get; set; }\n\n        /// <summary>\n        /// the name of the test class\n        /// </summary>\n        protected string TestClassName { get; set; }\n\n        /// <summary>\n        /// The name of the document used for tests\n        /// </summary>\n        protected string DocumentTypeName { get; set; }\n\n        /// <summary>\n        /// SUT: System Under Test\n        /// </summary>\n        protected static ITestRepository SUT { get; set; }\n\n        public MongoDbDocumentTestBase()\n        {\n            var type = CreateTestDocument();\n            DocumentTypeName = type.GetType().FullName;\n            if (type is IPartitionedDocument)\n            {\n                PartitionKey = ((IPartitionedDocument)type).PartitionKey;\n            }\n            TestClassName = GetClassName();\n        }\n\n        [OneTimeSetUp]\n        public void Init()\n        {\n            var connectionString = ConfigurationManager.ConnectionStrings[\"MongoDbTests\"].ConnectionString;\n            SUT = new TestRepository(connectionString, \"MongoDbTests\");\n        }\n\n        [OneTimeTearDown]\n        public void Cleanup()\n        {\n            // We drop the collection at the end of each test session.\n            if (!string.IsNullOrEmpty(PartitionKey))\n            {\n                SUT.DropTestCollection<T>(PartitionKey);\n            }\n            else\n            {\n                SUT.DropTestCollection<T>();\n            }\n        }\n\n        #region Add\n\n        [Test]\n        public void AddOne()\n        {\n            // Arrange\n            var document = new T();\n            // Act\n            SUT.AddOne(document);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T>(e => e.Id.Equals(document.Id)) \n                                                            : SUT.Count<T>(e => e.Id.Equals(document.Id), PartitionKey);\n            Assert.That(count, Is.EqualTo(1), GetTestName());\n        }\n\n        [Test]\n        public async Task AddOneAsync()\n        {\n            // Arrange\n            var document = new T();\n            // Act\n            await SUT.AddOneAsync(document);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? await SUT.CountAsync<T>(e => e.Id.Equals(document.Id))\n                                                            : await SUT.CountAsync<T>(e => e.Id.Equals(document.Id), PartitionKey);\n            Assert.That(count, Is.EqualTo(1), GetTestName());\n        }\n\n        [Test]\n        public void AddMany()\n        {\n            // Arrange\n            var documents = new List<T> { new T(), new T() };\n            // Act\n            SUT.AddMany(documents);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T>(e => e.Id.Equals(documents[0].Id)\n                                                                                   || e.Id.Equals(documents[1].Id))\n                                                            : SUT.Count<T>(e => e.Id.Equals(documents[0].Id)\n                                                                                  || e.Id.Equals(documents[1].Id), PartitionKey);\n            Assert.That(count, Is.EqualTo(2), GetTestName());\n        }\n\n        [Test]\n        public async Task AddManyAsync()\n        {\n            // Arrange\n            var documents = new List<T> { new T(), new T() };\n            // Act\n            await SUT.AddManyAsync(documents);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? await SUT.CountAsync<T>(e => e.Id.Equals(documents[0].Id)\n                    || e.Id.Equals(documents[1].Id))\n                                                            : await SUT.CountAsync<T>(e => e.Id.Equals(documents[0].Id)\n                                                                || e.Id.Equals(documents[1].Id), PartitionKey);\n            Assert.That(count, Is.EqualTo(2), GetTestName());\n        }\n\n\n        #endregion Add\n\n        #region Read\n\n        [Test]\n        public async Task GetByIdAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync(document);\n            // Act\n            var result = await SUT.GetByIdAsync<T>(document.Id, PartitionKey);\n            // Assert\n            Assert.That(result, Is.Not.Null, GetTestName());\n        }\n\n        [Test]\n        public void GetById()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = SUT.GetById<T>(document.Id, PartitionKey);\n            // Assert\n            Assert.That(result, Is.Not.Null, GetTestName());\n        }\n\n        [Test]\n        public async Task GetOneAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync(document);\n            // Act\n            var result = await SUT.GetOneAsync<T>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.That(result, Is.Not.Null, GetTestName());\n        }\n\n        [Test]\n        public void GetOne()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = SUT.GetOne<T>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.That(result, Is.Not.Null, GetTestName());\n        }\n\n        [Test]\n        public void GetCursor()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var cursor = SUT.GetCursor<T>(x => x.Id.Equals(document.Id), PartitionKey);\n            var count = cursor.CountDocuments();\n            // Assert\n            Assert.That(count, Is.EqualTo(1), GetTestName());\n        }\n\n        [Test]\n        public async Task AnyAsyncReturnsTrue()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync(document);\n            // Act\n            var result = await SUT.AnyAsync<T>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(true), GetTestName());\n        }\n\n        [Test]\n        public async Task AnyAsyncReturnsFalse()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync(document);\n            // Act\n            var result = await SUT.AnyAsync<T>(x => x.Id.Equals(Guid.NewGuid()), PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(false), GetTestName());\n        }\n\n        [Test]\n        public void AnyReturnsTrue()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = SUT.Any<T>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(true), GetTestName());\n        }\n\n        [Test]\n        public void AnyReturnsFalse()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = SUT.Any<T>(x => x.Id.Equals(Guid.NewGuid()), PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(false), GetTestName());\n        }\n\n        [Test]\n        public async Task GetAllAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            await SUT.AddManyAsync(documents);\n            // Act\n            var result = await SUT.GetAllAsync<T>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.That(result.Count, Is.EqualTo(5), GetTestName());\n        }\n\n        [Test]\n        public void GetAll()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany(documents);\n            // Act\n            var result = SUT.GetAll<T>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.That(result.Count, Is.EqualTo(5), GetTestName());\n        }\n\n        [Test]\n        public async Task CountAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            await SUT.AddManyAsync(documents);\n            // Act\n            var result = await SUT.CountAsync<T>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(5), GetTestName());\n        }\n\n        [Test]\n        public void Count()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany(documents);\n            // Act\n            var result = SUT.Count<T>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(5), GetTestName());\n        }\n\n        #endregion Read\n\n        #region Update\n\n        [Test]\n        public void UpdateOne()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            var content = GetContent();\n            document.SomeContent = content;\n            // Act\n            var result = SUT.UpdateOne(document);\n            // Assert\n            Assert.That(result);\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null, GetTestName());\n            Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());\n        }\n\n        [Test]\n        public async Task UpdateOneAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync(document);\n            var content = GetContent();\n            document.SomeContent = content;\n            // Act\n            var result = await SUT.UpdateOneAsync(document);\n            // Assert\n            Assert.That(result);\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null, GetTestName());\n            Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());\n        }\n\n        [Test]\n        public void UpdateOneField()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateOne(document, x => x.SomeContent, content);\n            // Assert\n            Assert.That(result, GetTestName());\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null, GetTestName());\n            Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());\n        }\n\n        [Test]\n        public async Task UpdateOneFieldAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync(document);\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateOneAsync(document, x => x.SomeContent, content);\n            // Assert\n            Assert.That(result, GetTestName());\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null, GetTestName());\n            Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());\n        }\n\n        [Test]\n        public void UpdateOneFieldWithFilter()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateOne<T, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.That(result, GetTestName());\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null, GetTestName());\n            Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());\n        }\n\n        [Test]\n        public async Task UpdateOneFieldWithFilterAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync(document);\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateOneAsync<T, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.That(result, GetTestName());\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null, GetTestName());\n            Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());\n        }\n\n        [Test]\n        public async Task UpdateOneAsyncWithUpdateDefinition()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync(document);\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = MongoDB.Driver.Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n\n            // Act\n            var result = await SUT.UpdateOneAsync(document, updateDef);\n            // Assert\n            Assert.That(result);\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null);\n            Assert.That(updatedDocument.Children[0].Type, Is.EqualTo(childrenToAdd[0].Type), GetTestName());\n            Assert.That(updatedDocument.Children[0].Value, Is.EqualTo(childrenToAdd[0].Value), GetTestName());\n            Assert.That(updatedDocument.Children[1].Type, Is.EqualTo(childrenToAdd[1].Type), GetTestName());\n            Assert.That(updatedDocument.Children[1].Value, Is.EqualTo(childrenToAdd[1].Value), GetTestName());\n        }\n\n        [Test]\n        public void UpdateOneWithUpdateDefinition()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = MongoDB.Driver.Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n\n            // Act\n            var result = SUT.UpdateOne(document, updateDef);\n            // Assert\n            Assert.That(result);\n            var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null);\n            Assert.That(updatedDocument.Children[0].Type, Is.EqualTo(childrenToAdd[0].Type), GetTestName());\n            Assert.That(updatedDocument.Children[0].Value, Is.EqualTo(childrenToAdd[0].Value), GetTestName());\n            Assert.That(updatedDocument.Children[1].Type, Is.EqualTo(childrenToAdd[1].Type), GetTestName());\n            Assert.That(updatedDocument.Children[1].Value, Is.EqualTo(childrenToAdd[1].Value), GetTestName());\n        }\n\n        #endregion Update\n\n        #region Delete\n\n        [Test]\n        public void DeleteOne()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = SUT.DeleteOne(document);\n            // Assert\n            Assert.That(result, Is.EqualTo(1));\n            Assert.That(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), Is.False, GetTestName());\n        }\n\n        [Test]\n        public void DeleteOneLinq()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne(document);\n            // Act\n            var result = SUT.DeleteOne<T>(e => e.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(1));\n            Assert.That(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), Is.False, GetTestName());\n        }\n\n        [Test]\n        public async Task DeleteOneAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync(document);\n            // Act\n            var result = await SUT.DeleteOneAsync(document);\n            // Assert\n            Assert.That(result, Is.EqualTo(1));\n            await Assert.ThatAsync(() => SUT.AnyAsync<T>(e => e.Id.Equals(document.Id), PartitionKey), Is.False, GetTestName());\n        }\n\n        [Test]\n        public async Task DeleteOneAsyncLinq()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync(document);\n            // Act\n            var result = await SUT.DeleteOneAsync<T>(e => e.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(1));\n            await Assert.ThatAsync(() => SUT.AnyAsync<T>(e => e.Id.Equals(document.Id), PartitionKey), Is.False, GetTestName());\n        }\n\n        [Test]\n        public async Task DeleteManyAsyncLinq()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            await SUT.AddManyAsync(documents);\n            // Act\n            var result = await SUT.DeleteManyAsync<T>(e => e.SomeContent == criteria, PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(5));\n            await Assert.ThatAsync(() => SUT.AnyAsync<T>(e => e.SomeContent == criteria, PartitionKey), Is.False, GetTestName());\n        }\n\n        [Test]\n        public async Task DeleteManyAsync()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            await SUT.AddManyAsync(documents);\n            // Act\n            var result = await SUT.DeleteManyAsync(documents);\n            // Assert\n            Assert.That(result, Is.EqualTo(5));\n            await Assert.ThatAsync(() => SUT.AnyAsync<T>(e => e.SomeContent == criteria, PartitionKey), Is.False, GetTestName());\n        }\n\n        [Test]\n        public void DeleteManyLinq()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            SUT.AddMany(documents);\n            // Act\n            var result = SUT.DeleteMany<T>(e => e.SomeContent == criteria, PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(5));\n            Assert.That(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), Is.False, GetTestName());\n        }\n\n        [Test]\n        public void DeleteMany()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            SUT.AddMany(documents);\n            // Act\n            var result = SUT.DeleteMany(documents);\n            // Assert\n            Assert.That(result, Is.EqualTo(5));\n            Assert.That(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), Is.False, GetTestName());\n        }\n\n        #endregion Delete\n\n        #region Project\n\n        [Test]\n        public async Task ProjectOneAsync()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var document = CreateTestDocument();\n            document.SomeContent = someContent;\n            document.Nested.SomeDate = someDate;\n            await SUT.AddOneAsync(document);\n            // Act\n            var result = await SUT.ProjectOneAsync<T, MyTestProjection>(\n                x => x.Id.Equals(document.Id),\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.That(result, Is.Not.Null, GetTestName());\n            Assert.That(result.SomeContent, Is.EqualTo(someContent), GetTestName());\n            Assert.That(result.SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());\n            Assert.That(result.SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());\n        }\n\n        [Test]\n        public void ProjectOne()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var document = CreateTestDocument();\n            document.SomeContent = someContent;\n            document.Nested.SomeDate = someDate;\n            SUT.AddOne(document);\n            // Act\n            var result = SUT.ProjectOne<T, MyTestProjection>(\n                x => x.Id.Equals(document.Id),\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.That(result, Is.Not.Null, GetTestName());\n            Assert.That(result.SomeContent, Is.EqualTo(someContent), GetTestName());\n            Assert.That(result.SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());\n            Assert.That(result.SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());\n        }\n\n        [Test]\n        public async Task ProjectManyAsync()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e =>\n            {\n                e.SomeContent = someContent;\n                e.Nested.SomeDate = someDate;\n            });\n\n            await SUT.AddManyAsync(documents);\n            // Act\n            var result = await SUT.ProjectManyAsync<T, MyTestProjection>(\n                x => x.SomeContent == someContent,\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.That(result.Count, Is.EqualTo(5), GetTestName());\n            Assert.That(result.First().SomeContent, Is.EqualTo(someContent), GetTestName());\n            Assert.That(result.First().SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());\n            Assert.That(result.First().SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());\n        }\n\n        [Test]\n        public void ProjectMany()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e =>\n            {\n                e.SomeContent = someContent;\n                e.Nested.SomeDate = someDate;\n            });\n\n            SUT.AddMany(documents);\n            // Act\n            var result = SUT.ProjectMany<T, MyTestProjection>(\n                x => x.SomeContent == someContent,\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.That(result.Count, Is.EqualTo(5), GetTestName());\n            Assert.That(result.First().SomeContent, Is.EqualTo(someContent), GetTestName());\n            Assert.That(result.First().SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());\n            Assert.That(result.First().SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());\n        }\n\n        #endregion Project\n\n        #region Group By\n\n        [Test]\n        public void GroupByTProjection()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            for (var i = 0; i < documents.Count - 2; i++)\n            {\n                documents[i].GroupingKey = 1;\n                documents[i].SomeContent = $\"{content}-{i}\";\n            }\n            for (var i = 3; i < documents.Count; i++)\n            {\n                documents[i].GroupingKey = 2;\n                documents[i].SomeContent = $\"{content}-{i}\";\n            }\n            SUT.AddMany(documents);\n\n            // Act\n            var result = SUT.GroupBy<T, int, ProjectedGroup>(\n                            e => e.GroupingKey, g => new ProjectedGroup\n                            {\n                                Key = g.Key,\n                                Content = g.Select(doc => doc.SomeContent).ToList()\n                            },\n                            PartitionKey);\n\n            // Assert\n            var key1Group = result.First(e => e.Key == 1);\n            Assert.That(key1Group, Is.Not.Null);\n            Assert.That(key1Group.Content, Has.Count.EqualTo(3));\n            var key2Group = result.First(e => e.Key == 2);\n            Assert.That(key2Group, Is.Not.Null);\n            Assert.That(key2Group.Content, Has.Count.EqualTo(2));\n        }\n\n        [Test]\n        public void FilteredGroupByTProjection()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            for (var i = 0; i < documents.Count - 2; i++)\n            {\n                documents[i].GroupingKey = 4;\n                documents[i].SomeContent = $\"{content}-{i}\";\n            }\n            for (var i = 3; i < documents.Count; i++)\n            {\n                documents[i].GroupingKey = 5;\n                documents[i].SomeContent = $\"{content}-{i}\";\n            }\n            var guid1 = Guid.NewGuid().ToString(\"n\");\n            var guid2 = Guid.NewGuid().ToString(\"n\");\n            for (var i = 0; i < documents.Count - 1; i++)\n            {\n                documents[i].Children = new List<Child> {\n                    new Child(guid1, guid2)\n                };\n            }\n\n            SUT.AddMany(documents);\n\n            // Act\n            var result = SUT.GroupBy<T, int, ProjectedGroup>(\n                            e => e.Children.Any(c => c.Type == guid1),\n                            e => e.GroupingKey, g => new ProjectedGroup\n                            {\n                                Key = g.Key,\n                                Content = g.Select(doc => doc.SomeContent).ToList()\n                            }, PartitionKey);\n\n            // Assert\n            var key1Group = result.First(e => e.Key == 4);\n            Assert.That(key1Group, Is.Not.Null);\n            Assert.That(key1Group.Content, Has.Count.EqualTo(3));\n            var key2Group = result.First(e => e.Key == 5);\n            Assert.That(key2Group, Is.Not.Null);\n            Assert.That(key2Group.Content, Has.Count.EqualTo(1));\n        }\n\n        #endregion Group By\n\n        #region Test Utils\n\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        private string GetCurrentMethod()\n        {\n            StackTrace st = new StackTrace();\n            StackFrame sf = st.GetFrame(1);\n\n            return sf.GetMethod().Name;\n        }\n\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        private string GetParentMethod()\n        {\n            StackTrace st = new StackTrace();\n            StackFrame sf = st.GetFrame(2);\n            var method = sf.GetMethod().DeclaringType.Name;\n            return method;\n        }\n\n        private string GetTestName()\n        {\n            return $\"{TestClassName}{PartitionKey}.{GetParentMethod()}\";\n        }\n\n        private string GetContent()\n        {\n            return $\"{TestClassName}{PartitionKey}.{Guid.NewGuid()}.{GetParentMethod()}\";\n        }\n\n        #endregion Test Utils\n    }\n\n\n}\n"
  },
  {
    "path": "IntegrationTests/Infrastructure/MongoDbTKeyDocumentTestBase.cs",
    "content": "﻿using MongoDbGenericRepository.Models;\nusing NUnit.Framework;\nusing System;\nusing System.Collections.Generic;\nusing System.Configuration;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Threading.Tasks;\n\nnamespace IntegrationTests.Infrastructure\n{\n    [TestFixture]\n    public abstract class MongoDbTKeyDocumentTestBase<T, TKey> \n        where T: TestDoc<TKey>, new()\n        where TKey : IEquatable<TKey>\n    {\n        public T CreateTestDocument()\n        {\n            return new T();\n        }\n\n        public abstract string GetClassName();\n\n        public List<T> CreateTestDocuments(int numberOfDocumentsToCreate)\n        {\n            var docs = new List<T>();\n            for (var i = 0; i < numberOfDocumentsToCreate; i++)\n            {\n                docs.Add(new T());\n            }\n            return docs;\n        }\n\n        /// <summary>\n        /// The partition key for the collection, if any\n        /// </summary>\n        protected string PartitionKey { get; set; }\n\n        /// <summary>\n        /// the name of the test class\n        /// </summary>\n        protected string TestClassName { get; set; }\n\n        /// <summary>\n        /// The name of the document used for tests\n        /// </summary>\n        protected string DocumentTypeName { get; set; }\n\n        /// <summary>\n        /// SUT: System Under Test\n        /// </summary>\n        protected static ITestRepository SUT { get; set; }\n\n        public MongoDbTKeyDocumentTestBase()\n        {\n            var type = CreateTestDocument();\n            DocumentTypeName = type.GetType().FullName;\n            if (type is IPartitionedDocument)\n            {\n                PartitionKey = ((IPartitionedDocument)type).PartitionKey;\n            }\n            TestClassName = GetClassName();\n        }\n\n        [OneTimeSetUp]\n        public void Init()\n        {\n            var connectionString = ConfigurationManager.ConnectionStrings[\"MongoDbTests\"].ConnectionString;\n            SUT = new TestRepository(connectionString, \"MongoDbTests\");\n        }\n\n        [OneTimeTearDown]\n        public void Cleanup()\n        {\n            // We drop the collection at the end of each test session.\n            if (!string.IsNullOrEmpty(PartitionKey))\n            {\n                SUT.DropTestCollection<T>(PartitionKey);\n            }\n            else\n            {\n                SUT.DropTestCollection<T>();\n            }\n        }\n\n        #region Add\n\n        [Test]\n        public void AddOne()\n        {\n            // Arrange\n            var document = new T();\n            // Act\n            SUT.AddOne<T, TKey>(document);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T, TKey>(e => e.Id.Equals(document.Id)) \n                                                            : SUT.Count<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);\n            Assert.That(count, Is.EqualTo(1), GetTestName());\n        }\n\n        [Test]\n        public async Task AddOneAsync()\n        {\n            // Arrange\n            var document = new T();\n            // Act\n            await SUT.AddOneAsync<T, TKey>(document);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? await SUT.CountAsync<T, TKey>(e => e.Id.Equals(document.Id))\n                                                            : await SUT.CountAsync<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);\n            Assert.That(count, Is.EqualTo(1), GetTestName());\n        }\n\n        [Test]\n        public void AddMany()\n        {\n            // Arrange\n            var documents = new List<T> { new T(), new T() };\n            // Act\n            SUT.AddMany<T, TKey>(documents);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T, TKey>(e => e.Id.Equals(documents[0].Id)\n                                                                                   || e.Id.Equals(documents[1].Id))\n                                                            : SUT.Count<T, TKey>(e => e.Id.Equals(documents[0].Id)\n                                                                                  || e.Id.Equals(documents[1].Id), PartitionKey);\n            Assert.That(count, Is.EqualTo(2), GetTestName());\n        }\n\n        [Test]\n        public async Task AddManyAsync()\n        {\n            // Arrange\n            var documents = new List<T> { new T(), new T() };\n            // Act\n            await SUT.AddManyAsync<T, TKey>(documents);\n            // Assert\n            long count = string.IsNullOrEmpty(PartitionKey) ? await SUT.CountAsync<T, TKey>(e => e.Id.Equals(documents[0].Id)\n                    || e.Id.Equals(documents[1].Id))\n                                                            : await SUT.CountAsync<T, TKey>(e => e.Id.Equals(documents[0].Id)\n                                                                || e.Id.Equals(documents[1].Id), PartitionKey);\n            Assert.That(count, Is.EqualTo(2), GetTestName());\n        }\n\n\n        #endregion Add\n\n        #region Read\n\n        [Test]\n        public async Task GetByIdAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync<T, TKey>(document);\n            // Act\n            var result = await SUT.GetByIdAsync<T, TKey>(document.Id, PartitionKey);\n            // Assert\n            Assert.That(result, Is.Not.Null, GetTestName());\n        }\n\n        [Test]\n        public void GetById()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            // Assert\n            Assert.That(result, Is.Not.Null, GetTestName());\n        }\n\n        [Test]\n        public async Task GetOneAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync<T, TKey>(document);\n            // Act\n            var result = await SUT.GetOneAsync<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.That(result, Is.Not.Null, GetTestName());\n        }\n\n        [Test]\n        public void GetOne()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.GetOne<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.That(result, Is.Not.Null, GetTestName());\n        }\n\n        [Test]\n        public void GetCursor()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var cursor = SUT.GetCursor<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);\n            var count = cursor.CountDocuments();\n            // Assert\n            Assert.That(count, Is.EqualTo(1), GetTestName());\n        }\n\n        [Test]\n        public async Task AnyAsyncReturnsTrue()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync<T, TKey>(document);\n            // Act\n            var result = await SUT.AnyAsync<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(true), GetTestName());\n        }\n\n        [Test]\n        public async Task AnyAsyncReturnsFalse()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync<T, TKey>(document);\n            // Act\n            var result = await SUT.AnyAsync<T, TKey>(x => x.Id.Equals(document.Init<TKey>()), PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(false), GetTestName());\n        }\n\n        [Test]\n        public void AnyReturnsTrue()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.Any<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(true), GetTestName());\n        }\n\n        [Test]\n        public void AnyReturnsFalse()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.Any<T, TKey>(x => x.Id.Equals(document.Init<TKey>()), PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(false), GetTestName());\n        }\n\n        [Test]\n        public async Task GetAllAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            await SUT.AddManyAsync<T, TKey>(documents);\n            // Act\n            var result = await SUT.GetAllAsync<T, TKey>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.That(result.Count, Is.EqualTo(5), GetTestName());\n        }\n\n        [Test]\n        public void GetAll()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = SUT.GetAll<T, TKey>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.That(result.Count, Is.EqualTo(5), GetTestName());\n        }\n\n        [Test]\n        public async Task CountAsync()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            await SUT.AddManyAsync<T, TKey>(documents);\n            // Act\n            var result = await SUT.CountAsync<T, TKey>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(5), GetTestName());\n        }\n\n        [Test]\n        public void Count()\n        {\n            // Arrange\n            var documents = CreateTestDocuments(5);\n            var content = GetContent();\n            documents.ForEach(e => e.SomeContent = content);\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = SUT.Count<T, TKey>(x => x.SomeContent == content, PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(5), GetTestName());\n        }\n\n        #endregion Read\n\n        #region Update\n\n        [Test]\n        public void UpdateOne()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            var content = GetContent();\n            document.SomeContent = content;\n            // Act\n            var result = SUT.UpdateOne<T, TKey>(document);\n            // Assert\n            Assert.That(result);\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null, GetTestName());\n            Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());\n        }\n\n        [Test]\n        public async Task UpdateOneAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync<T, TKey>(document);\n            var content = GetContent();\n            document.SomeContent = content;\n            // Act\n            var result = await SUT.UpdateOneAsync<T, TKey>(document);\n            // Assert\n            Assert.That(result);\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null, GetTestName());\n            Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());\n        }\n\n        [Test]\n        public void UpdateOneField()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateOne<T, TKey, string>(document, x => x.SomeContent, content);\n            // Assert\n            Assert.That(result, GetTestName());\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null, GetTestName());\n            Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());\n        }\n\n        [Test]\n        public async Task UpdateOneFieldAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync<T, TKey>(document);\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateOneAsync<T, TKey, string>(document, x => x.SomeContent, content);\n            // Assert\n            Assert.That(result, GetTestName());\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null, GetTestName());\n            Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());\n        }\n\n        [Test]\n        public void UpdateOneFieldWithFilter()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            var content = GetContent();\n            // Act\n            var result = SUT.UpdateOne<T, TKey, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.That(result, GetTestName());\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null, GetTestName());\n            Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());\n        }\n\n        [Test]\n        public async Task UpdateOneFieldWithFilterAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync<T, TKey>(document);\n            var content = GetContent();\n            // Act\n            var result = await SUT.UpdateOneAsync<T, TKey, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);\n            // Assert\n            Assert.That(result, GetTestName());\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null, GetTestName());\n            Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());\n        }\n\n        [Test]\n        public async Task UpdateOneAsyncWithUpdateDefinition()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync<T, TKey>(document);\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = MongoDB.Driver.Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n\n            // Act\n            var result = await SUT.UpdateOneAsync<T, TKey>(document, updateDef);\n            // Assert\n            Assert.That(result);\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null);\n            Assert.That(updatedDocument.Children[0].Type, Is.EqualTo(childrenToAdd[0].Type), GetTestName());\n            Assert.That(updatedDocument.Children[0].Value, Is.EqualTo(childrenToAdd[0].Value), GetTestName());\n            Assert.That(updatedDocument.Children[1].Type, Is.EqualTo(childrenToAdd[1].Type), GetTestName());\n            Assert.That(updatedDocument.Children[1].Value, Is.EqualTo(childrenToAdd[1].Value), GetTestName());\n        }\n\n        [Test]\n        public void UpdateOneWithUpdateDefinition()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            var childrenToAdd = new List<Child>\n            {\n                new Child(\"testType1\", \"testValue1\"),\n                new Child(\"testType2\", \"testValue2\")\n            };\n\n            var updateDef = MongoDB.Driver.Builders<T>.Update.AddToSetEach(p => p.Children, childrenToAdd);\n\n            // Act\n            var result = SUT.UpdateOne<T, TKey>(document, updateDef);\n            // Assert\n            Assert.That(result);\n            var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);\n            Assert.That(updatedDocument, Is.Not.Null);\n            Assert.That(updatedDocument.Children[0].Type, Is.EqualTo(childrenToAdd[0].Type), GetTestName());\n            Assert.That(updatedDocument.Children[0].Value, Is.EqualTo(childrenToAdd[0].Value), GetTestName());\n            Assert.That(updatedDocument.Children[1].Type, Is.EqualTo(childrenToAdd[1].Type), GetTestName());\n            Assert.That(updatedDocument.Children[1].Value, Is.EqualTo(childrenToAdd[1].Value), GetTestName());\n        }\n\n        #endregion Update\n\n        #region Delete\n\n        [Test]\n        public void DeleteOne()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.DeleteOne<T, TKey>(document);\n            // Assert\n            Assert.That(result, Is.EqualTo(1));\n            Assert.That(SUT.Any<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), Is.False, GetTestName());\n        }\n\n        [Test]\n        public void DeleteOneLinq()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.DeleteOne<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(1));\n            Assert.That(SUT.Any<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), Is.False, GetTestName());\n        }\n\n        [Test]\n        public async Task DeleteOneAsync()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync<T, TKey>(document);\n            // Act\n            var result = await SUT.DeleteOneAsync<T, TKey>(document);\n            // Assert\n            Assert.That(result, Is.EqualTo(1));\n            await Assert.ThatAsync(() => SUT.AnyAsync<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), Is.False, GetTestName());\n        }\n\n        [Test]\n        public async Task DeleteOneAsyncLinq()\n        {\n            // Arrange\n            var document = CreateTestDocument();\n            await SUT.AddOneAsync<T, TKey>(document);\n            // Act\n            var result = await SUT.DeleteOneAsync<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(1));\n            await Assert.ThatAsync(() => SUT.AnyAsync<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), Is.False, GetTestName());\n        }\n\n        [Test]\n        public async Task DeleteManyAsyncLinq()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            await SUT.AddManyAsync<T, TKey>(documents);\n            // Act\n            var result = await SUT.DeleteManyAsync<T, TKey>(e => e.SomeContent == criteria, PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(5));\n            await Assert.ThatAsync(() => SUT.AnyAsync<T, TKey>(e => e.SomeContent == criteria, PartitionKey), Is.False, GetTestName());\n        }\n\n        [Test]\n        public async Task DeleteManyAsync()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            await SUT.AddManyAsync<T, TKey>(documents);\n            // Act\n            var result = await SUT.DeleteManyAsync<T, TKey>(documents);\n            // Assert\n            Assert.That(result, Is.EqualTo(5));\n            await Assert.ThatAsync(() => SUT.AnyAsync<T, TKey>(e => e.SomeContent == criteria, PartitionKey), Is.False, GetTestName());\n        }\n\n        [Test]\n        public void DeleteManyLinq()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = SUT.DeleteMany<T, TKey>(e => e.SomeContent == criteria, PartitionKey);\n            // Assert\n            Assert.That(result, Is.EqualTo(5));\n            Assert.That(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), Is.False, GetTestName());\n        }\n\n        [Test]\n        public void DeleteMany()\n        {\n            // Arrange\n            var criteria = $\"{GetTestName()}.{DocumentTypeName}\";\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e => e.SomeContent = criteria);\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = SUT.DeleteMany<T, TKey>(documents);\n            // Assert\n            Assert.That(result, Is.EqualTo(5));\n            Assert.That(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), Is.False, GetTestName());\n        }\n\n        #endregion Delete\n\n        #region Project\n\n        [Test]\n        public async Task ProjectOneAsync()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var document = CreateTestDocument();\n            document.SomeContent = someContent;\n            document.Nested.SomeDate = someDate;\n            await SUT.AddOneAsync<T, TKey>(document);\n            // Act\n            var result = await SUT.ProjectOneAsync<T, MyTestProjection, TKey>(\n                x => x.Id.Equals(document.Id),\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.That(result, Is.Not.Null, GetTestName());\n            Assert.That(result.SomeContent, Is.EqualTo(someContent), GetTestName());\n            Assert.That(result.SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());\n            Assert.That(result.SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());\n        }\n\n        [Test]\n        public void ProjectOne()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var document = CreateTestDocument();\n            document.SomeContent = someContent;\n            document.Nested.SomeDate = someDate;\n            SUT.AddOne<T, TKey>(document);\n            // Act\n            var result = SUT.ProjectOne<T, MyTestProjection, TKey>(\n                x => x.Id.Equals(document.Id),\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.That(result, Is.Not.Null, GetTestName());\n            Assert.That(result.SomeContent, Is.EqualTo(someContent), GetTestName());\n            Assert.That(result.SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());\n            Assert.That(result.SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());\n        }\n\n        [Test]\n        public async Task ProjectManyAsync()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e =>\n            {\n                e.SomeContent = someContent;\n                e.Nested.SomeDate = someDate;\n            });\n\n            await SUT.AddManyAsync<T, TKey>(documents);\n            // Act\n            var result = await SUT.ProjectManyAsync<T, MyTestProjection, TKey>(\n                x => x.SomeContent == someContent,\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.That(result.Count, Is.EqualTo(5), GetTestName());\n            Assert.That(result.First().SomeContent, Is.EqualTo(someContent), GetTestName());\n            Assert.That(result.First().SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());\n            Assert.That(result.First().SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());\n        }\n\n        [Test]\n        public void ProjectMany()\n        {\n            // Arrange\n            var someContent = GetContent();\n            var someDate = DateTime.UtcNow;\n            var documents = CreateTestDocuments(5);\n            documents.ForEach(e =>\n            {\n                e.SomeContent = someContent;\n                e.Nested.SomeDate = someDate;\n            });\n\n            SUT.AddMany<T, TKey>(documents);\n            // Act\n            var result = SUT.ProjectMany<T, MyTestProjection, TKey>(\n                x => x.SomeContent == someContent,\n                x => new MyTestProjection\n                {\n                    SomeContent = x.SomeContent,\n                    SomeDate = x.Nested.SomeDate\n                },\n                PartitionKey);\n            // Assert\n            Assert.That(result.Count, Is.EqualTo(5), GetTestName());\n            Assert.That(result.First().SomeContent, Is.EqualTo(someContent), GetTestName());\n            Assert.That(result.First().SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());\n            Assert.That(result.First().SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());\n        }\n\n        #endregion Project\n\n        #region Test Utils\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        private string GetCurrentMethod()\n        {\n            StackTrace st = new StackTrace();\n            StackFrame sf = st.GetFrame(1);\n\n            return sf.GetMethod().Name;\n        }\n\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        private string GetParentMethod()\n        {\n            StackTrace st = new StackTrace();\n            StackFrame sf = st.GetFrame(2);\n            var method = sf.GetMethod().DeclaringType.Name;\n            return method;\n        }\n\n        private string GetTestName()\n        {\n            return $\"{TestClassName}{PartitionKey}.{GetParentMethod()}\";\n        }\n\n        private string GetContent()\n        {\n            return $\"{TestClassName}{PartitionKey}.{Guid.NewGuid()}.{GetParentMethod()}\";\n        }\n\n        #endregion Test Utils\n    }\n}\n"
  },
  {
    "path": "IntegrationTests/Infrastructure/RandomExtensions.cs",
    "content": "﻿using System;\n\nnamespace IntegrationTests.Infrastructure\n{\n    // Thanks BlueRaja - Danny Pflughoeft https://stackoverflow.com/a/13095144/5103354\n    /// <summary>\n    /// Extensions for the random number generator <see cref=\"Random\"/>\n    /// </summary>\n    public static class RandomExtensions\n    {\n\n        /// <summary>\n        /// Returns a random long from min (inclusive) to max (exclusive)\n        /// </summary>\n        /// <param name=\"random\">The given random instance</param>\n        /// <param name=\"min\">The inclusive minimum bound</param>\n        /// <param name=\"max\">The exclusive maximum bound.  Must be greater than min</param>\n        public static long NextLong(this Random random, long min, long max)\n        {\n            if (max <= min)\n                throw new ArgumentOutOfRangeException(\"max\", \"max must be > min!\");\n\n            //Working with ulong so that modulo works correctly with values > long.MaxValue\n            ulong uRange = (ulong)(max - min);\n\n            //Prevent a modulo bias; see https://stackoverflow.com/a/10984975/238419\n            //for more information.\n            //In the worst case, the expected number of calls is 2 (though usually it's\n            //much closer to 1) so this loop doesn't really hurt performance at all.\n            ulong ulongRand;\n            do\n            {\n                byte[] buf = new byte[8];\n                random.NextBytes(buf);\n                ulongRand = (ulong)BitConverter.ToInt64(buf, 0);\n            } while (ulongRand > ulong.MaxValue - ((ulong.MaxValue % uRange) + 1) % uRange);\n\n            return (long)(ulongRand % uRange) + min;\n        }\n\n        /// <summary>\n        /// Returns a random long from 0 (inclusive) to max (exclusive)\n        /// </summary>\n        /// <param name=\"random\">The given random instance</param>\n        /// <param name=\"max\">The exclusive maximum bound.  Must be greater than 0</param>\n        public static long NextLong(this Random random, long max)\n        {\n            return random.NextLong(0, max);\n        }\n\n        /// <summary>\n        /// Returns a random long over all possible values of long (except long.MaxValue, similar to\n        /// random.Next())\n        /// </summary>\n        /// <param name=\"random\">The given random instance</param>\n        public static long NextLong(this Random random)\n        {\n            return random.NextLong(long.MinValue, long.MaxValue);\n        }\n    }\n}\n"
  },
  {
    "path": "IntegrationTests/Infrastructure/TestClasses.cs",
    "content": "﻿using MongoDB.Bson.Serialization.Attributes;\nusing MongoDbGenericRepository.Models;\nusing MongoDbGenericRepository.Utils;\nusing System;\nusing System.Collections.Generic;\n\nnamespace IntegrationTests.Infrastructure\n{\n    public class ProjectedGroup\n    {\n        public int Key { get; set; }\n        public List<string> Content { get; set; }\n    }\n\n    public class MyTestProjection\n    {\n        public string SomeContent { get; set; }\n        public DateTime SomeDate { get; set; }\n    }\n\n    public class Nested\n    {\n        public DateTime SomeDate { get; set; }\n    }\n\n    public class Child\n    {\n        public Child(string type, string value)\n        {\n            Type = type;\n            Value = value;\n        }\n\n        public string Type { get; set; }\n        public string Value { get; set; }\n    }\n\n    public class TestDoc : Document\n    {\n        public TestDoc()\n        {\n            Version = 2;\n            Nested = new Nested\n            {\n                SomeDate = DateTime.UtcNow\n            };\n            Children = new List<Child>();\n        }\n\n        public string SomeContent { get; set; }\n\n        public int GroupingKey { get; set; }\n\n        public Nested Nested { get; set; }\n\n        public List<Child> Children { get; set; }\n\n    }\n\n    public class TestDoc<TKey> : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n    {\n        [BsonId]\n        public TKey Id { get; set; }\n        public int Version { get; set; }\n\n        public TestDoc()\n        {\n            InitializeFields();\n            Version = 2;\n            Nested = new Nested\n            {\n                SomeDate = DateTime.UtcNow\n            };\n            Children = new List<Child>();\n        }\n\n        public string SomeContent { get; set; }\n\n        public Nested Nested { get; set; }\n\n        public List<Child> Children { get; set; }\n\n        public TId Init<TId>()\n        {\n            return IdGenerator.GetId<TId>();\n        }\n\n        private void InitializeFields()\n        {\n            Id = Init<TKey>();\n        }\n    }\n}\n"
  },
  {
    "path": "IntegrationTests/Infrastructure/TestRepository.cs",
    "content": "﻿using MongoDB.Driver;\nusing MongoDbGenericRepository;\nusing MongoDbGenericRepository.Models;\nusing System;\nusing System.Linq.Expressions;\nusing System.Threading.Tasks;\n\nnamespace IntegrationTests.Infrastructure\n{\n    public class TestRepository : BaseMongoRepository, ITestRepository\n    {\n        /// <inheritdoc />\n        public TestRepository(string connectionString, string databaseName) : base(connectionString, databaseName)\n        {\n        }\n\n        public void DropTestCollection<TDocument>()\n        {\n            MongoDbContext.DropCollection<TDocument>();\n        }\n\n        public void DropTestCollection<TDocument>(string partitionKey)\n        {\n            MongoDbContext.DropCollection<TDocument>(partitionKey);\n        }\n    }\n}\n"
  },
  {
    "path": "IntegrationTests/IntegrationTests.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"15.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"..\\packages\\NUnit3TestAdapter.4.6.0\\build\\net462\\NUnit3TestAdapter.props\" Condition=\"Exists('..\\packages\\NUnit3TestAdapter.4.6.0\\build\\net462\\NUnit3TestAdapter.props')\" />\n  <Import Project=\"..\\packages\\NUnit.4.2.2\\build\\NUnit.props\" Condition=\"Exists('..\\packages\\NUnit.4.2.2\\build\\NUnit.props')\" />\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{A484A355-A015-40CC-9B35-A4E872421128}</ProjectGuid>\n    <OutputType>Library</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>IntegrationTests</RootNamespace>\n    <AssemblyName>IntegrationTests</AssemblyName>\n    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n    <NuGetPackageImportStamp>\n    </NuGetPackageImportStamp>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"AWSSDK.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\AWSSDK.Core.3.7.100.14\\lib\\net45\\AWSSDK.Core.dll</HintPath>\n    </Reference>\n    <Reference Include=\"AWSSDK.SecurityToken, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\AWSSDK.SecurityToken.3.7.100.14\\lib\\net45\\AWSSDK.SecurityToken.dll</HintPath>\n    </Reference>\n    <Reference Include=\"DnsClient, Version=1.6.1.0, Culture=neutral, PublicKeyToken=4574bb5573c51424, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\DnsClient.1.6.1\\lib\\net471\\DnsClient.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\Microsoft.Bcl.AsyncInterfaces.5.0.0\\lib\\net461\\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Extensions.Logging.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\Microsoft.Extensions.Logging.Abstractions.2.0.0\\lib\\netstandard2.0\\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Win32.Registry, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\Microsoft.Win32.Registry.5.0.0\\lib\\net461\\Microsoft.Win32.Registry.dll</HintPath>\n    </Reference>\n    <Reference Include=\"MongoDB.Bson, Version=2.30.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\MongoDB.Bson.2.30.0\\lib\\net472\\MongoDB.Bson.dll</HintPath>\n    </Reference>\n    <Reference Include=\"MongoDB.Driver, Version=2.30.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\MongoDB.Driver.2.30.0\\lib\\net472\\MongoDB.Driver.dll</HintPath>\n    </Reference>\n    <Reference Include=\"MongoDB.Driver.Core, Version=2.30.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\MongoDB.Driver.Core.2.30.0\\lib\\net472\\MongoDB.Driver.Core.dll</HintPath>\n    </Reference>\n    <Reference Include=\"MongoDB.Libmongocrypt, Version=1.12.0.0, Culture=neutral, PublicKeyToken=94992a530f44e321, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\MongoDB.Libmongocrypt.1.12.0\\lib\\net472\\MongoDB.Libmongocrypt.dll</HintPath>\n    </Reference>\n    <Reference Include=\"mscorlib\" />\n    <Reference Include=\"nunit.framework, Version=4.2.2.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\NUnit.4.2.2\\lib\\net462\\nunit.framework.dll</HintPath>\n    </Reference>\n    <Reference Include=\"nunit.framework.legacy, Version=4.2.2.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\NUnit.4.2.2\\lib\\net462\\nunit.framework.legacy.dll</HintPath>\n    </Reference>\n    <Reference Include=\"SharpCompress, Version=0.30.1.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\SharpCompress.0.30.1\\lib\\net461\\SharpCompress.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Snappier, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a1b25124e6e13a3a, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\Snappier.1.0.0\\lib\\netstandard2.0\\Snappier.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.Buffers.4.5.1\\lib\\net461\\System.Buffers.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.ComponentModel.Composition\" />\n    <Reference Include=\"System.Configuration\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.IO.4.3.0\\lib\\net462\\System.IO.dll</HintPath>\n      <Private>True</Private>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.Memory.4.5.5\\lib\\net461\\System.Memory.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.Net.Http.4.3.4\\lib\\net46\\System.Net.Http.dll</HintPath>\n      <Private>True</Private>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"System.Numerics\" />\n    <Reference Include=\"System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.Numerics.Vectors.4.5.0\\lib\\net46\\System.Numerics.Vectors.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.Runtime.4.3.0\\lib\\net462\\System.Runtime.dll</HintPath>\n      <Private>True</Private>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.Runtime.CompilerServices.Unsafe.5.0.0\\lib\\net45\\System.Runtime.CompilerServices.Unsafe.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.Runtime.InteropServices.RuntimeInformation.4.3.0\\lib\\net45\\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>\n      <Private>True</Private>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"System.Security.AccessControl, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.Security.AccessControl.5.0.0\\lib\\net461\\System.Security.AccessControl.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Security.Cryptography.Algorithms, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.Security.Cryptography.Algorithms.4.3.0\\lib\\net463\\System.Security.Cryptography.Algorithms.dll</HintPath>\n      <Private>True</Private>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.Security.Cryptography.Encoding.4.3.0\\lib\\net46\\System.Security.Cryptography.Encoding.dll</HintPath>\n      <Private>True</Private>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.Security.Cryptography.Primitives.4.3.0\\lib\\net46\\System.Security.Cryptography.Primitives.dll</HintPath>\n      <Private>True</Private>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.Security.Cryptography.X509Certificates.4.3.0\\lib\\net461\\System.Security.Cryptography.X509Certificates.dll</HintPath>\n      <Private>True</Private>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"System.Security.Principal.Windows, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.Security.Principal.Windows.5.0.0\\lib\\net461\\System.Security.Principal.Windows.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Text.Encoding.CodePages, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.Text.Encoding.CodePages.5.0.0\\lib\\net461\\System.Text.Encoding.CodePages.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.Threading.Tasks.Extensions.4.5.4\\lib\\net461\\System.Threading.Tasks.Extensions.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\System.ValueTuple.4.5.0\\lib\\net47\\System.ValueTuple.dll</HintPath>\n    </Reference>\n    <Reference Include=\"ZstdSharp, Version=0.7.3.0, Culture=neutral, PublicKeyToken=8d151af33a4ad5cf, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\ZstdSharp.Port.0.7.3\\lib\\net461\\ZstdSharp.dll</HintPath>\n    </Reference>\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"CRUDObjectIdTests.cs\" />\n    <Compile Include=\"CRUDPartitionedTests.cs\" />\n    <Compile Include=\"CRUDTKeyPartitionedCollectionNameAttributeTests.cs\" />\n    <Compile Include=\"CRUDTests.cs\" />\n    <Compile Include=\"CRUDPartitionedCollectionNameAttributeTests.cs\" />\n    <Compile Include=\"CRUDTKeyPartitionedTests.cs\" />\n    <Compile Include=\"CRUDTKeyTests.cs\" />\n    <Compile Include=\"Infrastructure\\BaseMongoDbRepositoryTests.cs\" />\n    <Compile Include=\"Infrastructure\\GlobalVariables.cs\" />\n    <Compile Include=\"Infrastructure\\ITestRepository.cs\" />\n    <Compile Include=\"Infrastructure\\MongoDbDocumentTestBase.cs\" />\n    <Compile Include=\"Infrastructure\\MongoDbTKeyDocumentTestBase.cs\" />\n    <Compile Include=\"Infrastructure\\RandomExtensions.cs\" />\n    <Compile Include=\"Infrastructure\\TestClasses.cs\" />\n    <Compile Include=\"Infrastructure\\TestRepository.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"App.config\">\n      <SubType>Designer</SubType>\n    </None>\n    <None Include=\"libmongocrypt.dylib\" />\n    <None Include=\"libmongocrypt.so\" />\n    <None Include=\"packages.config\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Service Include=\"{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\MongoDbGenericRepository\\MongoDbGenericRepository.csproj\">\n      <Project>{efc776c4-2af3-440c-be80-3fbe335817a5}</Project>\n      <Name>MongoDbGenericRepository</Name>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <Analyzer Include=\"..\\packages\\AWSSDK.SecurityToken.3.7.100.14\\analyzers\\dotnet\\cs\\AWSSDK.SecurityToken.CodeAnalysis.dll\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Content Include=\"mongocrypt.dll\" />\n  </ItemGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <Import Project=\"..\\packages\\MongoDB.Libmongocrypt.1.12.0\\build\\MongoDB.Libmongocrypt.targets\" Condition=\"Exists('..\\packages\\MongoDB.Libmongocrypt.1.12.0\\build\\MongoDB.Libmongocrypt.targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('..\\packages\\MongoDB.Libmongocrypt.1.12.0\\build\\MongoDB.Libmongocrypt.targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\packages\\MongoDB.Libmongocrypt.1.12.0\\build\\MongoDB.Libmongocrypt.targets'))\" />\n    <Error Condition=\"!Exists('..\\packages\\NUnit.4.2.2\\build\\NUnit.props')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\packages\\NUnit.4.2.2\\build\\NUnit.props'))\" />\n    <Error Condition=\"!Exists('..\\packages\\NUnit3TestAdapter.4.6.0\\build\\net462\\NUnit3TestAdapter.props')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\packages\\NUnit3TestAdapter.4.6.0\\build\\net462\\NUnit3TestAdapter.props'))\" />\n  </Target>\n</Project>"
  },
  {
    "path": "IntegrationTests/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// Les informations générales relatives à un assembly dépendent de\n// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations\n// associées à un assembly.\n[assembly: AssemblyTitle(\"IntegrationTests\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"\")]\n[assembly: AssemblyProduct(\"IntegrationTests\")]\n[assembly: AssemblyCopyright(\"Copyright ©  2017\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly\n// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de\n// COM, affectez la valeur true à l'attribut ComVisible sur ce type.\n[assembly: ComVisible(false)]\n\n// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM\n[assembly: Guid(\"a484a355-a015-40cc-9b35-a4e872421128\")]\n\n// Les informations de version pour un assembly se composent des quatre valeurs suivantes :\n//\n//      Version principale\n//      Version secondaire\n//      Numéro de build\n//      Révision\n//\n// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut\n// en utilisant '*', comme indiqué ci-dessous :\n// [assembly: AssemblyVersion(\"1.0.*\")]\n[assembly: AssemblyVersion(\"1.0.0.0\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n"
  },
  {
    "path": "IntegrationTests/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"AWSSDK.Core\" version=\"3.7.100.14\" targetFramework=\"net48\" />\n  <package id=\"AWSSDK.SecurityToken\" version=\"3.7.100.14\" targetFramework=\"net48\" />\n  <package id=\"DnsClient\" version=\"1.6.1\" targetFramework=\"net48\" />\n  <package id=\"Microsoft.Bcl.AsyncInterfaces\" version=\"5.0.0\" targetFramework=\"net48\" />\n  <package id=\"Microsoft.Extensions.Logging.Abstractions\" version=\"2.0.0\" targetFramework=\"net48\" />\n  <package id=\"Microsoft.Win32.Registry\" version=\"5.0.0\" targetFramework=\"net48\" />\n  <package id=\"MongoDB.Bson\" version=\"2.30.0\" targetFramework=\"net48\" />\n  <package id=\"MongoDB.Driver\" version=\"2.30.0\" targetFramework=\"net48\" />\n  <package id=\"MongoDB.Driver.Core\" version=\"2.30.0\" targetFramework=\"net48\" />\n  <package id=\"MongoDB.Libmongocrypt\" version=\"1.12.0\" targetFramework=\"net48\" />\n  <package id=\"NUnit\" version=\"4.2.2\" targetFramework=\"net48\" />\n  <package id=\"NUnit3TestAdapter\" version=\"4.6.0\" targetFramework=\"net48\" />\n  <package id=\"SharpCompress\" version=\"0.30.1\" targetFramework=\"net48\" />\n  <package id=\"Snappier\" version=\"1.0.0\" targetFramework=\"net48\" />\n  <package id=\"System.Buffers\" version=\"4.5.1\" targetFramework=\"net48\" />\n  <package id=\"System.IO\" version=\"4.3.0\" targetFramework=\"net48\" />\n  <package id=\"System.Memory\" version=\"4.5.5\" targetFramework=\"net48\" />\n  <package id=\"System.Net.Http\" version=\"4.3.4\" targetFramework=\"net48\" />\n  <package id=\"System.Numerics.Vectors\" version=\"4.5.0\" targetFramework=\"net48\" />\n  <package id=\"System.Runtime\" version=\"4.3.0\" targetFramework=\"net48\" />\n  <package id=\"System.Runtime.CompilerServices.Unsafe\" version=\"5.0.0\" targetFramework=\"net48\" />\n  <package id=\"System.Runtime.InteropServices.RuntimeInformation\" version=\"4.3.0\" targetFramework=\"net48\" />\n  <package id=\"System.Security.AccessControl\" version=\"5.0.0\" targetFramework=\"net48\" />\n  <package id=\"System.Security.Cryptography.Algorithms\" version=\"4.3.0\" targetFramework=\"net48\" />\n  <package id=\"System.Security.Cryptography.Encoding\" version=\"4.3.0\" targetFramework=\"net48\" />\n  <package id=\"System.Security.Cryptography.Primitives\" version=\"4.3.0\" targetFramework=\"net48\" />\n  <package id=\"System.Security.Cryptography.X509Certificates\" version=\"4.3.0\" targetFramework=\"net48\" />\n  <package id=\"System.Security.Principal.Windows\" version=\"5.0.0\" targetFramework=\"net48\" />\n  <package id=\"System.Text.Encoding.CodePages\" version=\"5.0.0\" targetFramework=\"net48\" />\n  <package id=\"System.Threading.Tasks.Extensions\" version=\"4.5.4\" targetFramework=\"net48\" />\n  <package id=\"System.ValueTuple\" version=\"4.5.0\" targetFramework=\"net48\" />\n  <package id=\"ZstdSharp.Port\" version=\"0.7.3\" targetFramework=\"net48\" />\n</packages>"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2018 Alexandre SPIESER\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "MongoDbGenericRepository/Abstractions/IBaseMongoRepository.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The IBaseMongoRepository interface exposes the CRUD functionality of the BaseMongoRepository.\n    /// </summary>\n    public interface IBaseMongoRepository :\n        IReadOnlyMongoRepository,\n        IBaseMongoRepository_Create,\n        IBaseMongoRepository_Update,\n        IBaseMongoRepository_Delete,\n        IBaseMongoRepository_Index\n    {\n        /// <summary>\n        ///     Asynchronously returns a paginated list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\"></param>\n        /// <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n        /// <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<List<TDocument>> GetPaginatedAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument;\n\n        /// <summary>\n        ///     Asynchronously returns a paginated list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\"></param>\n        /// <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n        /// <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<List<TDocument>> GetPaginatedAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     GetAndUpdateOne with filter\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\"></param>\n        /// <param name=\"update\"></param>\n        /// <param name=\"options\"></param>\n        /// <returns></returns>\n        Task<TDocument> GetAndUpdateOne<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> update,\n            FindOneAndUpdateOptions<TDocument, TDocument> options)\n            where TDocument : IDocument;\n\n        /// <summary>\n        ///     GetAndUpdateOne with filter\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\"></param>\n        /// <param name=\"update\"></param>\n        /// <param name=\"options\"></param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns></returns>\n        Task<TDocument> GetAndUpdateOne<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> update,\n            FindOneAndUpdateOptions<TDocument, TDocument> options,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument;\n\n        /// <summary>\n        ///     GetAndUpdateOne with filter\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\"></param>\n        /// <param name=\"update\"></param>\n        /// <param name=\"options\"></param>\n        /// <returns></returns>\n        Task<TDocument> GetAndUpdateOne<TDocument, TKey>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> update,\n            FindOneAndUpdateOptions<TDocument, TDocument> options)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     GetAndUpdateOne with filter\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\"></param>\n        /// <param name=\"update\"></param>\n        /// <param name=\"options\"></param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns></returns>\n        Task<TDocument> GetAndUpdateOne<TDocument, TKey>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> update,\n            FindOneAndUpdateOptions<TDocument, TDocument> options,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/Abstractions/IBaseMongoRepository_Update.cs",
    "content": "﻿using MongoDB.Driver;\nusing MongoDbGenericRepository.Models;\nusing System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    /// The IBaseMongoRepository_Update interface exposing update functionality for documents with Guid Ids.\n    /// </summary>\n    public interface IBaseMongoRepository_Update : IBaseMongoRepository_Update<Guid>\n    {\n        /// <summary>\n        /// Asynchronously Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument modifiedDocument)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Asynchronously Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument modifiedDocument, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        bool UpdateOne<TDocument, TKey>(TDocument modifiedDocument)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool UpdateOne<TDocument, TKey>(TDocument modifiedDocument, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Takes a document you want to modify and applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"update\">The update definition for the document.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Takes a document you want to modify and applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"update\">The update definition for the document.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Takes a document you want to modify and applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"update\">The update definition for the document.</param>\n        bool UpdateOne<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Takes a document you want to modify and applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"update\">The update definition for the document.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool UpdateOne<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entity selected by the filter, updates the property field with the given value..\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entity selected by the filter, updates the property field with the given value..\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entity selected by the filter, updates the property field with the given value..\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entity selected by the filter, updates the property field with the given value..\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entity selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entity selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entity selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entity selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        bool UpdateOne<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool UpdateOne<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        long UpdateMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        long UpdateMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/Abstractions/IBaseMongoRepository_Update_ClientSession.cs",
    "content": "﻿using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository.DataAccess.Update\n{\n    /// <summary>\n    ///     The IBaseMongoRepository_Update_ClientSession interface exposing update functionality with a IClientSessionHandle.\n    /// </summary>\n    public interface IBaseMongoRepository_Update_ClientSession\n    {\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"partitionKey\">The optional partition key.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"partitionKey\">The optional partition key.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"partitionKey\">The optional partition key.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"partitionKey\">The optional partition key.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"documentToModify\">The document to modify.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"documentToModify\">The document to modify.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"documentToModify\">The document to modify.</param>\n        /// <param name=\"update\">The update definition.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"documentToModify\">The document to modify.</param>\n        /// <param name=\"update\">The update definition.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        bool UpdateOne<TDocument, TKey>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            UpdateDefinition<TDocument> update,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"partitionKey\">The optional partition key.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"partitionKey\">The optional partition key.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <returns></returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns></returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"partitionKey\">The optional partition key.</param>\n        /// <returns></returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"partitionKey\">The optional partition key.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns></returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"documentToModify\">The document to modify.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"documentToModify\">The document to modify.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"documentToModify\">The document to modify.</param>\n        /// <param name=\"update\">The update definition.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"documentToModify\">The document to modify.</param>\n        /// <param name=\"update\">The update definition.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns>A boolean value indicating success.</returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            UpdateDefinition<TDocument> update,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/Abstractions/IBaseReadOnlyRepository.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The IBaseReadOnlyRepository exposes the generic Read Only functionality of the BaseMongoRepository.\n    /// </summary>\n    public interface IBaseReadOnlyRepository\n    {\n        /// <summary>\n        ///     The connection string.\n        /// </summary>\n        string ConnectionString { get; }\n\n        /// <summary>\n        ///     The database name.\n        /// </summary>\n        string DatabaseName { get; }\n\n        #region Read TKey\n\n        /// <summary>\n        ///     Asynchronously returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        Task<TDocument> GetByIdAsync<TDocument, TKey>(TKey id)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetByIdAsync<TDocument, TKey>(TKey id, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<TDocument> GetByIdAsync<TDocument, TKey>(TKey id, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetByIdAsync<TDocument, TKey>(TKey id, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        TDocument GetById<TDocument, TKey>(TKey id)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TDocument GetById<TDocument, TKey>(TKey id, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        TDocument GetById<TDocument, TKey>(TKey id, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TDocument GetById<TDocument, TKey>(TKey id, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, string partitionKey)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetOneAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n\n        /// <summary>\n        ///     Returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TDocument GetOne<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        Task<TDocument> GetOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<TDocument> GetOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        TDocument GetOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TDocument GetOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        TDocument GetOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TDocument GetOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a collection cursor.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        IFindFluent<TDocument, TDocument> GetCursor<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<bool> AnyAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            CountOptions countOption,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        Task<bool> AnyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<bool> AnyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<bool> AnyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<bool> AnyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        bool Any<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        bool Any<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        bool Any<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        bool Any<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        List<TDocument> GetAll<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        List<TDocument> GetAll<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        List<TDocument> GetAll<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        List<TDocument> GetAll<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        List<TDocument> GetAll<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<long> CountAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            CountOptions countOption,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        long Count<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        long Count<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        long Count<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        long Count<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        long Count<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        long Count<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        long Count<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        long Count<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        Task<long> CountAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<long> CountAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        Task<long> CountAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<long> CountAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        long Count<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">An optional Cancellation Token.</param>\n        long Count<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        long Count<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        /// <param name=\"cancellationToken\">An optional Cancellation Token.</param>\n        long Count<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        #endregion\n\n        #region Min / Max\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by descending.</param>\n        Task<TDocument> GetByMaxAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by descending.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetByMaxAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by descending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        Task<TDocument> GetByMaxAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by descending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetByMaxAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByDescending\">A property selector to order by descending.</param>\n        TDocument GetByMax<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByDescending\">A property selector to order by descending.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TDocument GetByMax<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> orderByDescending,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByDescending\">A property selector to order by descending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        TDocument GetByMax<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> orderByDescending,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByDescending\">A property selector to order by descending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TDocument GetByMax<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> orderByDescending,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector for the minimum value you are looking for.</param>\n        Task<TDocument> GetByMinAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector for the minimum value you are looking for.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetByMinAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector for the minimum value you are looking for.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        Task<TDocument> GetByMinAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector for the minimum value you are looking for.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<TDocument> GetByMinAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector for the minimum value you are looking for.</param>\n        TDocument GetByMin<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector for the minimum value you are looking for.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TDocument GetByMin<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector for the minimum value you are looking for.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        TDocument GetByMin<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector for the minimum value you are looking for.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TDocument GetByMin<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector for the maximum value you are looking for.</param>\n        Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector for the maximum value you are looking for.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector for the maximum value you are looking for.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector for the maximum value you are looking for.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n        TValue GetMaxValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TValue GetMaxValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        TValue GetMaxValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TValue GetMaxValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        TValue GetMinValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TValue GetMinValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        TValue GetMinValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TValue GetMinValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        #endregion\n\n        #region Sum\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        Task<int> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<int> SumByAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        Task<int> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<int> SumByAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        int SumBy<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector, string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        Task<decimal> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, decimal>> selector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<decimal> SumByAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        Task<decimal> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, decimal>> selector, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<decimal> SumByAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        decimal SumBy<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        #endregion Sum\n\n        #region Project TKey\n\n        /// <summary>\n        ///     Asynchronously returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\"></param>\n        /// <param name=\"projection\">The projection expression.</param>\n        TProjection ProjectOne<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\"></param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TProjection ProjectOne<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\"></param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        TProjection ProjectOne<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\"></param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        TProjection ProjectOne<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\"></param>\n        /// <param name=\"projection\">The projection expression.</param>\n        List<TProjection> ProjectMany<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\"></param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        List<TProjection> ProjectMany<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\"></param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        List<TProjection> ProjectMany<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\"></param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        List<TProjection> ProjectMany<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        #endregion\n\n        #region Group By\n\n        /// <summary>\n        ///     Groups filtered a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups filtered a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups filtered a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups filtered a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups filtered a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups filtered a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups filtered a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups filtered a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new();\n\n        #endregion Group By\n\n        #region Pagination\n\n        /// <summary>\n        ///     Asynchronously returns a paginated list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"sortSelector\">The property selector.</param>\n        /// <param name=\"ascending\">Order of the sorting.</param>\n        /// <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n        /// <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<List<TDocument>> GetSortedPaginatedAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> sortSelector,\n            bool ascending = true,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a paginated list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"sortDefinition\">The sort definition.</param>\n        /// <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n        /// <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<List<TDocument>> GetSortedPaginatedAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            SortDefinition<TDocument> sortDefinition,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        #endregion Pagination\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/Abstractions/IMongoDbContext.cs",
    "content": "﻿using MongoDB.Driver;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    /// This is the interface of the IMongoDbContext which is managed by the <see cref=\"BaseMongoRepository\"/>.\n    /// </summary>\n    public interface IMongoDbContext\n    {\n        /// <summary>\n        /// The IMongoClient from the official MongoDb driver\n        /// </summary>\n        IMongoClient Client { get; }\n\n        /// <summary>\n        /// The IMongoDatabase from the official Mongodb driver\n        /// </summary>\n        IMongoDatabase Database { get; }\n\n        /// <summary>\n        /// Returns a collection for a document type that has a partition key.\n        /// </summary>\n        /// <typeparam name=\"TDocument\"></typeparam>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        IMongoCollection<TDocument> GetCollection<TDocument>(string partitionKey = null);\n\n        /// <summary>\n        /// Drops a collection having a partitionKey, use very carefully.\n        /// </summary>\n        /// <typeparam name=\"TDocument\"></typeparam>\n        void DropCollection<TDocument>(string partitionKey = null);\n\n        /// <summary>\n        /// Sets the Guid representation of the MongoDb Driver.\n        /// </summary>\n        /// <param name=\"guidRepresentation\">The new value of the GuidRepresentation</param>\n        void SetGuidRepresentation(MongoDB.Bson.GuidRepresentation guidRepresentation);\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/Abstractions/IReadOnlyMongoRepository.TKey.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     read only repository interface\n    /// </summary>\n    /// <typeparam name=\"TKey\">The key type</typeparam>\n    public interface IReadOnlyMongoRepository<TKey>\n        where TKey : IEquatable<TKey>\n    {\n        #region Read\n\n        /// <summary>\n        ///     Asynchronously returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        Task<TDocument> GetByIdAsync<TDocument>(TKey id)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<TDocument> GetByIdAsync<TDocument>(TKey id, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<TDocument> GetByIdAsync<TDocument>(TKey id, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<TDocument> GetByIdAsync<TDocument>(TKey id, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        TDocument GetById<TDocument>(TKey id)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TDocument GetById<TDocument>(TKey id, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        TDocument GetById<TDocument>(TKey id, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TDocument GetById<TDocument>(TKey id, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        Task<TDocument> GetOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>;\n\n\n        /// <summary>\n        ///     Asynchronously returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        Task<TDocument> GetOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<TDocument> GetOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        Task<TDocument> GetOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        TDocument GetOne<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        TDocument GetOne<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        TDocument GetOne<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        TDocument GetOne<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns a collection cursor.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        IFindFluent<TDocument, TDocument> GetCursor<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        Task<bool> AnyAsync<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> AnyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<bool> AnyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> AnyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        bool Any<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        bool Any<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        bool Any<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        bool Any<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        Task<List<TDocument>> GetAllAsync<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        Task<List<TDocument>> GetAllAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        List<TDocument> GetAll<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        List<TDocument> GetAll<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        List<TDocument> GetAll<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        List<TDocument> GetAll<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        Task<long> CountAsync<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> CountAsync<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<long> CountAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> CountAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        long Count<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The Cancellation token.</param>\n        long Count<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        long Count<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The Cancellation token.</param>\n        long Count<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        #endregion\n\n        #region Min / Max\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByDescending\">A property selector to order by descending.</param>\n        Task<TDocument> GetByMaxAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByDescending\">A property selector to order by descending.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<TDocument> GetByMaxAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> orderByDescending,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByDescending\">A property selector to order by descending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        Task<TDocument> GetByMaxAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> orderByDescending,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByDescending\">A property selector to order by descending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<TDocument> GetByMaxAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> orderByDescending,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByDescending\">A property selector to order by descending.</param>\n        /// <returns></returns>\n        TDocument GetByMax<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByDescending\">A property selector to order by descending.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns></returns>\n        TDocument GetByMax<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> orderByDescending,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByDescending\">A property selector to order by descending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <returns></returns>\n        TDocument GetByMax<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByDescending\">A property selector to order by descending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns></returns>\n        TDocument GetByMax<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> orderByDescending,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByAscending\">A property selector to order by ascending.</param>\n        Task<TDocument> GetByMinAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByAscending\">A property selector to order by ascending.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<TDocument> GetByMinAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> orderByAscending,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByAscending\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        Task<TDocument> GetByMinAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> orderByAscending,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByAscending\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<TDocument> GetByMinAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> orderByAscending,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByAscending\">A property selector to order by ascending.</param>\n        TDocument GetByMin<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByAscending\">A property selector to order by ascending.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TDocument GetByMin<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> orderByAscending,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByAscending\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        TDocument GetByMin<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"orderByAscending\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TDocument GetByMin<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> orderByAscending,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n        Task<TValue> GetMaxValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<TValue> GetMaxValueAsync<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        Task<TValue> GetMaxValueAsync<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<TValue> GetMaxValueAsync<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n        TValue GetMaxValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TValue GetMaxValue<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        TValue GetMaxValue<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TValue GetMaxValue<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        Task<TValue> GetMinValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector)\n            where TDocument : IDocument<TKey>;\n\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<TValue> GetMinValueAsync<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<TValue> GetMinValueAsync<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<TValue> GetMinValueAsync<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        TValue GetMinValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TValue GetMinValue<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        TValue GetMinValue<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TValue GetMinValue<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        #endregion\n\n        #region Maths\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        Task<int> SumByAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<int> SumByAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        Task<int> SumByAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<int> SumByAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        Task<decimal> SumByAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, decimal>> selector)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<decimal> SumByAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        Task<decimal> SumByAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, decimal>> selector, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<decimal> SumByAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        int SumBy<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            string partitionKey = null)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        decimal SumBy<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            string partitionKey = null)\n            where TDocument : IDocument<TKey>;\n\n        #endregion Maths\n\n        #region Project\n\n        /// <summary>\n        ///     Asynchronously returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        Task<TProjection> ProjectOneAsync<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        Task<TProjection> ProjectOneAsync<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<TProjection> ProjectOneAsync<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        Task<TProjection> ProjectOneAsync<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        TProjection ProjectOne<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TProjection ProjectOne<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        TProjection ProjectOne<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TProjection ProjectOne<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        List<TProjection> ProjectMany<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        List<TProjection> ProjectMany<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        List<TProjection> ProjectMany<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        List<TProjection> ProjectMany<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class;\n\n        #endregion Project\n\n        #region Group By\n\n        /// <summary>\n        ///     Groups a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups filtered a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups filtered a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups filtered a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups filtered a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new();\n\n        #endregion Group By\n\n        #region Pagination\n\n        /// <summary>\n        ///     Asynchronously returns a paginated list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"sortSelector\">The property selector.</param>\n        /// <param name=\"ascending\">Order of the sorting.</param>\n        /// <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n        /// <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<List<TDocument>> GetSortedPaginatedAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> sortSelector,\n            bool ascending = true,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a paginated list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"sortDefinition\">The sort definition.</param>\n        /// <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n        /// <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<List<TDocument>> GetSortedPaginatedAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            SortDefinition<TDocument> sortDefinition,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>;\n\n        #endregion Pagination\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/Abstractions/IReadOnlyMongoRepository.cs",
    "content": "﻿using System;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    /// The IReadOnlyMongoRepository exposes the readonly functionality of the BaseMongoRepository.\n    /// </summary>\n    public interface IReadOnlyMongoRepository : IBaseReadOnlyRepository, IReadOnlyMongoRepository<Guid>\n    {\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/Attributes/CollectionNameAttribute.cs",
    "content": "﻿using System;\n\nnamespace MongoDbGenericRepository.Attributes\n{\n    /// <summary>\n    /// This attribute allows you to specify of the name of the collection.\n    /// Added at commit c117bf2a7fee378f1e02199dea9b2023a7089ee2 by https://github.com/Etchelon\n    /// who has included the CollectionName attribute into the repo to give another choice to the user on how \n    /// to name their collections. \n    /// The attribute takes precedence of course, and if not present the library will fall back to your Pluralize method.\n    /// </summary>\n\t[AttributeUsage(AttributeTargets.Class)]\n\tpublic class CollectionNameAttribute : Attribute\n\t{\n        /// <summary>\n        /// The name of the collection in which your documents are stored.\n        /// </summary>\n\t\tpublic string Name { get; set; }\n\n        /// <summary>\n        /// The constructor.\n        /// </summary>\n        /// <param name=\"name\">The name of the collection.</param>\n\t\tpublic CollectionNameAttribute(string name)\n\t\t{\n\t\t\tthis.Name = name;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "MongoDbGenericRepository/BaseMongoRepository.Create.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n    ///     Its constructor must be given a connection string and a database name.\n    /// </summary>\n    public abstract partial class BaseMongoRepository : IBaseMongoRepository_Create\n    {\n        private readonly object _initLock = new object();\n        private IMongoDbCreator _mongoDbCreator;\n\n        /// <summary>\n        ///     The MongoDbCreator field.\n        /// </summary>\n        protected virtual IMongoDbCreator MongoDbCreator\n        {\n            get\n            {\n                if (_mongoDbCreator != null)\n                {\n                    return _mongoDbCreator;\n                }\n\n                lock (_initLock)\n                {\n                    if (_mongoDbCreator == null)\n                    {\n                        _mongoDbCreator = new MongoDbCreator(MongoDbContext);\n                    }\n                }\n\n                return _mongoDbCreator;\n            }\n            set => _mongoDbCreator = value;\n        }\n\n        /// <inheritdoc />\n        public virtual async Task AddOneAsync<TDocument, TKey>(TDocument document)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            await AddOneAsync<TDocument, TKey>(document, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task AddOneAsync<TDocument, TKey>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            await MongoDbCreator.AddOneAsync<TDocument, TKey>(document, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task AddOneAsync<TDocument>(TDocument document)\n            where TDocument : IDocument<Guid>\n        {\n            await AddOneAsync<TDocument, Guid>(document, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task AddOneAsync<TDocument>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            await AddOneAsync<TDocument, Guid>(document, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual void AddOne<TDocument, TKey>(TDocument document)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            AddOne<TDocument, TKey>(document, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual void AddOne<TDocument, TKey>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            MongoDbCreator.AddOne<TDocument, TKey>(document, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual void AddOne<TDocument>(TDocument document)\n            where TDocument : IDocument<Guid>\n        {\n            AddOne<TDocument, Guid>(document, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual void AddOne<TDocument>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            AddOne<TDocument, Guid>(document, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task AddManyAsync<TDocument, TKey>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            await AddManyAsync<TDocument, TKey>(documents, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task AddManyAsync<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            await MongoDbCreator.AddManyAsync<TDocument, TKey>(documents, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task AddManyAsync<TDocument>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<Guid>\n        {\n            await AddManyAsync<TDocument, Guid>(documents, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task AddManyAsync<TDocument>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            await AddManyAsync<TDocument, Guid>(documents, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual void AddMany<TDocument, TKey>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            AddMany<TDocument, TKey>(documents, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual void AddMany<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            MongoDbCreator.AddMany<TDocument, TKey>(documents, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual void AddMany<TDocument>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<Guid>\n        {\n            AddMany<TDocument, Guid>(documents, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual void AddMany<TDocument>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            AddMany<TDocument, Guid>(documents, cancellationToken);\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/BaseMongoRepository.Delete.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    public abstract partial class BaseMongoRepository : IBaseMongoRepository_Delete\n    {\n        private IMongoDbEraser _mongoDbEraser;\n\n        /// <summary>\n        ///     The MongoDbEraser used to delete documents.\n        /// </summary>\n        protected virtual IMongoDbEraser MongoDbEraser\n        {\n            get\n            {\n                if (_mongoDbEraser != null)\n                {\n                    return _mongoDbEraser;\n                }\n\n                lock (_initLock)\n                {\n                    if (_mongoDbEraser == null)\n                    {\n                        _mongoDbEraser = new MongoDbEraser(MongoDbContext);\n                    }\n                }\n\n                return _mongoDbEraser;\n            }\n            set => _mongoDbEraser = value;\n        }\n\n        #region Delete\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument>(TDocument document)\n            where TDocument : IDocument<Guid>\n        {\n            return DeleteOne(document, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return DeleteOne<TDocument, Guid>(document, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<Guid>\n        {\n            return DeleteOne(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return DeleteOne(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return DeleteOne(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return DeleteOne<TDocument, Guid>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument>(TDocument document)\n            where TDocument : IDocument<Guid>\n        {\n            return await DeleteOneAsync(document, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await DeleteOneAsync<TDocument, Guid>(document, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<Guid>\n        {\n            return await DeleteOneAsync(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await DeleteOneAsync(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await DeleteOneAsync(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await DeleteOneAsync<TDocument, Guid>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<long> DeleteManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<Guid>\n        {\n            return await DeleteManyAsync(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<long> DeleteManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await DeleteManyAsync(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await DeleteManyAsync(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<long> DeleteManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await DeleteManyAsync<TDocument, Guid>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteManyAsync<TDocument>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<Guid>\n        {\n            return await DeleteManyAsync<TDocument, Guid>(documents);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteManyAsync<TDocument>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await DeleteManyAsync<TDocument, Guid>(documents, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<Guid>\n        {\n            return DeleteMany<TDocument, Guid>(documents, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return DeleteMany<TDocument, Guid>(documents, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<Guid>\n        {\n            return DeleteMany(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return DeleteMany(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return DeleteMany(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return DeleteMany<TDocument, Guid>(filter, partitionKey, cancellationToken);\n        }\n\n        #endregion Delete\n\n        #region Delete TKey\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument, TKey>(TDocument document)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return DeleteOne<TDocument, TKey>(document, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument, TKey>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbEraser.DeleteOne<TDocument, TKey>(document, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return DeleteOne<TDocument, TKey>(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return DeleteOne<TDocument, TKey>(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return DeleteOne<TDocument, TKey>(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbEraser.DeleteOne<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument, TKey>(TDocument document)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await DeleteOneAsync<TDocument, TKey>(document, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument, TKey>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbEraser.DeleteOneAsync<TDocument, TKey>(document, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await DeleteOneAsync<TDocument, TKey>(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await DeleteOneAsync<TDocument, TKey>(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await DeleteOneAsync<TDocument, TKey>(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbEraser.DeleteOneAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await DeleteManyAsync<TDocument, TKey>(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await DeleteManyAsync<TDocument, TKey>(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await DeleteManyAsync<TDocument, TKey>(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteManyAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbEraser.DeleteManyAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteManyAsync<TDocument, TKey>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await DeleteManyAsync<TDocument, TKey>(documents, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteManyAsync<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbEraser.DeleteManyAsync<TDocument, TKey>(documents, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument, TKey>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return DeleteMany<TDocument, TKey>(documents, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbEraser.DeleteMany<TDocument, TKey>(documents, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return DeleteMany<TDocument, TKey>(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return DeleteMany<TDocument, TKey>(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return DeleteMany<TDocument, TKey>(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbEraser.DeleteMany<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        #endregion\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/BaseMongoRepository.Index.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n    ///     Its constructor must be given a connection string and a database name.\n    /// </summary>\n    public abstract partial class BaseMongoRepository : IBaseMongoRepository_Index\n    {\n        private IMongoDbIndexHandler _mongoDbIndexHandler;\n\n        /// <summary>\n        ///     The MongoDb accessor to manage indexes.\n        /// </summary>\n        protected virtual IMongoDbIndexHandler MongoDbIndexHandler\n        {\n            get\n            {\n                if (_mongoDbIndexHandler != null)\n                {\n                    return _mongoDbIndexHandler;\n                }\n\n                lock (_initLock)\n                {\n                    if (_mongoDbIndexHandler == null)\n                    {\n                        _mongoDbIndexHandler = new MongoDbIndexHandler(MongoDbContext);\n                    }\n                }\n\n                return _mongoDbIndexHandler;\n            }\n            set => _mongoDbIndexHandler = value;\n        }\n\n        /// <inheritdoc />\n        public async Task<List<string>> GetIndexesNamesAsync<TDocument>()\n            where TDocument : IDocument<Guid>\n        {\n            return await GetIndexesNamesAsync<TDocument, Guid>(null, CancellationToken.None);\n        }\n\n\n        /// <inheritdoc />\n        public async Task<List<string>> GetIndexesNamesAsync<TDocument>(CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await GetIndexesNamesAsync<TDocument, Guid>(null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<List<string>> GetIndexesNamesAsync<TDocument>(string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await GetIndexesNamesAsync<TDocument, Guid>(partitionKey);\n        }\n\n        /// <inheritdoc />\n        public async Task<List<string>> GetIndexesNamesAsync<TDocument>(string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await GetIndexesNamesAsync<TDocument, Guid>(partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<string>> GetIndexesNamesAsync<TDocument, TKey>()\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetIndexesNamesAsync<TDocument, TKey>(null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<string>> GetIndexesNamesAsync<TDocument, TKey>(CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetIndexesNamesAsync<TDocument, TKey>(null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<string>> GetIndexesNamesAsync<TDocument, TKey>(string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetIndexesNamesAsync<TDocument, TKey>(partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<string>> GetIndexesNamesAsync<TDocument, TKey>(string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbIndexHandler.GetIndexesNamesAsync<TDocument, TKey>(partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateTextIndexAsync<TDocument, Guid>(field, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateTextIndexAsync<TDocument, Guid>(field, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateTextIndexAsync<TDocument, Guid>(field, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateTextIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateTextIndexAsync<TDocument, Guid>(field, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateTextIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateTextIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateTextIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateTextIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateTextIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateTextIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateTextIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateTextIndexAsync<TDocument, TKey>(field, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateTextIndexAsync<TDocument, TKey>(field, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateTextIndexAsync<TDocument, TKey>(field, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateTextIndexAsync<TDocument, TKey>(field, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateTextIndexAsync<TDocument, TKey>(field, indexCreationOptions, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateTextIndexAsync<TDocument, TKey>(field, indexCreationOptions, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateTextIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbIndexHandler.CreateTextIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateAscendingIndexAsync<TDocument, Guid>(field, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateAscendingIndexAsync<TDocument, Guid>(field, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateAscendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateAscendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateAscendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateAscendingIndexAsync<TDocument, Guid>(field, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateAscendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateAscendingIndexAsync<TDocument, Guid>(field, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateAscendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateAscendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateAscendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateAscendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateAscendingIndexAsync<TDocument, TKey>(field, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateAscendingIndexAsync<TDocument, TKey>(field, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateAscendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateAscendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateAscendingIndexAsync<TDocument, TKey>(field, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateAscendingIndexAsync<TDocument, TKey>(field, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateAscendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbIndexHandler.CreateAscendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateDescendingIndexAsync<TDocument, Guid>(field, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateDescendingIndexAsync<TDocument, Guid>(field, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateDescendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateDescendingIndexAsync<TDocument, Guid>(field, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateDescendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateDescendingIndexAsync<TDocument, Guid>(field, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateDescendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateDescendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateDescendingIndexAsync<TDocument, TKey>(field, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateDescendingIndexAsync<TDocument, TKey>(field, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateDescendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, null, CancellationToken.None);\n        }\n\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateDescendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateDescendingIndexAsync<TDocument, TKey>(field, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateDescendingIndexAsync<TDocument, TKey>(field, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateDescendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbIndexHandler.CreateDescendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateHashedIndexAsync<TDocument, Guid>(field, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateHashedIndexAsync<TDocument, Guid>(field, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateHashedIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateHashedIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateHashedIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateHashedIndexAsync<TDocument, Guid>(field, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateHashedIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateHashedIndexAsync<TDocument, Guid>(field, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateHashedIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateHashedIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateHashedIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateHashedIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateHashedIndexAsync<TDocument, TKey>(field, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateHashedIndexAsync<TDocument, TKey>(field, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateHashedIndexAsync<TDocument, TKey>(field, indexCreationOptions, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateHashedIndexAsync<TDocument, TKey>(field, indexCreationOptions, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateHashedIndexAsync<TDocument, TKey>(field, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateHashedIndexAsync<TDocument, TKey>(field, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateHashedIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbIndexHandler.CreateHashedIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateCombinedTextIndexAsync<TDocument, TKey>(fields, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateCombinedTextIndexAsync<TDocument, TKey>(fields, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateCombinedTextIndexAsync<TDocument, TKey>(fields, indexCreationOptions, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateCombinedTextIndexAsync<TDocument, TKey>(fields, indexCreationOptions, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateCombinedTextIndexAsync<TDocument, TKey>(fields, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateCombinedTextIndexAsync<TDocument, TKey>(fields, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CreateCombinedTextIndexAsync<TDocument, TKey>(fields, indexCreationOptions, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbIndexHandler.CreateCombinedTextIndexAsync<TDocument, TKey>(fields, indexCreationOptions, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task DropIndexAsync<TDocument>(string indexName)\n            where TDocument : IDocument<Guid>\n        {\n            await DropIndexAsync<TDocument, Guid>(indexName, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task DropIndexAsync<TDocument>(string indexName, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            await DropIndexAsync<TDocument, Guid>(indexName, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task DropIndexAsync<TDocument>(string indexName, string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            await DropIndexAsync<TDocument, Guid>(indexName, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task DropIndexAsync<TDocument>(string indexName, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            await DropIndexAsync<TDocument, Guid>(indexName, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task DropIndexAsync<TDocument, TKey>(string indexName)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            await DropIndexAsync<TDocument, TKey>(indexName, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task DropIndexAsync<TDocument, TKey>(string indexName, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            await DropIndexAsync<TDocument, TKey>(indexName, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task DropIndexAsync<TDocument, TKey>(string indexName, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            await DropIndexAsync<TDocument, TKey>(indexName, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task DropIndexAsync<TDocument, TKey>(string indexName, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            await MongoDbIndexHandler.DropIndexAsync<TDocument, TKey>(indexName, partitionKey, cancellationToken);\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/BaseMongoRepository.Main.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.Models;\nusing MongoDbGenericRepository.Utils;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n    ///     Its constructor must be given a connection string and a database name.\n    /// </summary>\n    public abstract partial class BaseMongoRepository : ReadOnlyMongoRepository, IBaseMongoRepository\n    {\n        /// <summary>\n        ///     The constructor taking a connection string and a database name.\n        /// </summary>\n        /// <param name=\"connectionString\">The connection string of the MongoDb server.</param>\n        /// <param name=\"databaseName\">The name of the database against which you want to perform operations.</param>\n        protected BaseMongoRepository(string connectionString, string databaseName = null) : base(connectionString, databaseName)\n        {\n        }\n\n        /// <summary>\n        ///     The constructor taking a <see cref=\"IMongoDbContext\" />.\n        /// </summary>\n        /// <param name=\"mongoDbContext\">A mongodb context implementing <see cref=\"IMongoDbContext\" /></param>\n        protected BaseMongoRepository(IMongoDbContext mongoDbContext) : base(mongoDbContext)\n        {\n        }\n\n        /// <summary>\n        ///     The constructor taking a <see cref=\"IMongoDatabase\" />.\n        /// </summary>\n        /// <param name=\"mongoDatabase\">A mongodb context implementing <see cref=\"IMongoDatabase\" /></param>\n        protected BaseMongoRepository(IMongoDatabase mongoDatabase) : base(mongoDatabase)\n        {\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TDocument>> GetPaginatedAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument\n        {\n            return await HandlePartitioned<TDocument>(partitionKey).Find(filter).Skip(skipNumber).Limit(takeNumber).ToListAsync(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TDocument>> GetPaginatedAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter).Skip(skipNumber).Limit(takeNumber).ToListAsync(cancellationToken);\n        }\n\n        /// <summary>\n        ///     Sets the value of the document Id if it is not set already.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"document\">The document.</param>\n        protected void FormatDocument<TDocument, TKey>(TDocument document)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            if (document == null)\n            {\n                throw new ArgumentNullException(nameof(document));\n            }\n\n            var defaultTKey = default(TKey);\n            if (document.Id == null\n                || (defaultTKey != null\n                    && defaultTKey.Equals(document.Id)))\n            {\n                document.Id = IdGenerator.GetId<TKey>();\n            }\n        }\n\n        /// <summary>\n        ///     Sets the value of the document Id if it is not set already.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"document\">The document.</param>\n        protected void FormatDocument<TDocument>(TDocument document)\n            where TDocument : IDocument\n        {\n            if (document == null)\n            {\n                throw new ArgumentNullException(nameof(document));\n            }\n\n            if (document.Id == default)\n            {\n                document.Id = Guid.NewGuid();\n            }\n        }\n\n        /// <summary>\n        ///     Gets a collections for a potentially partitioned document type.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"partitionKey\">The collection partition key.</param>\n        /// <returns></returns>\n        protected virtual IMongoCollection<TDocument> HandlePartitioned<TDocument>(string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            if (!string.IsNullOrEmpty(partitionKey))\n            {\n                return GetCollection<TDocument>(partitionKey);\n            }\n\n            return GetCollection<TDocument>();\n        }\n\n        /// <summary>\n        ///     Gets a collections for the type TDocument with a partition key.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"partitionKey\">The collection partition key.</param>\n        /// <returns></returns>\n        protected virtual IMongoCollection<TDocument> GetCollection<TDocument>(string partitionKey = null)\n            where TDocument : IDocument<Guid>\n        {\n            return MongoDbContext.GetCollection<TDocument>(partitionKey);\n        }\n\n        #region Find And Update\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetAndUpdateOne<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> update,\n            FindOneAndUpdateOptions<TDocument, TDocument> options)\n            where TDocument : IDocument\n        {\n            return await GetAndUpdateOne(filter, update, options, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetAndUpdateOne<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> update,\n            FindOneAndUpdateOptions<TDocument, TDocument> options,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument\n        {\n            return await GetCollection<TDocument>().FindOneAndUpdateAsync(filter, update, options, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetAndUpdateOne<TDocument, TKey>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> update,\n            FindOneAndUpdateOptions<TDocument, TDocument> options)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetAndUpdateOne<TDocument, TKey>(filter, update, options, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetAndUpdateOne<TDocument, TKey>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> update,\n            FindOneAndUpdateOptions<TDocument, TDocument> options,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetCollection<TDocument, TKey>().FindOneAndUpdateAsync(filter, update, options, cancellationToken);\n        }\n\n        #endregion Find And Update\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/BaseMongoRepository.Update.ClientSession.cs",
    "content": "﻿using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    public abstract partial class BaseMongoRepository : IBaseMongoRepository_Update_ClientSession\n    {\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey>(session, modifiedDocument, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(\n            IClientSessionHandle session,\n            TDocument modifiedDocument,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey>(session, modifiedDocument, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey>(session, modifiedDocument, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, TKey>(session, modifiedDocument, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            UpdateDefinition<TDocument> update)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey>(session, documentToModify, update, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            UpdateDefinition<TDocument> update,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey>(session, documentToModify, update, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey>(session, documentToModify, update, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            UpdateDefinition<TDocument> update,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, TKey>(session, documentToModify, update, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey, TField>(session, documentToModify, field, value, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(session, documentToModify, field, value, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(session, documentToModify, field, value, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(session, documentToModify, field, value, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey, TField>(session, filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey, TField>(session, filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey, TField>(session, filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(session, filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey, TField>(session, filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey, TField>(session, filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey, TField>(session, filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(session, filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(session, filter, field, value, null, CancellationToken.None);\n        }\n\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(session, filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(session, filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(session, filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(session, Builders<TDocument>.Filter.Where(filter), field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(session, Builders<TDocument>.Filter.Where(filter), field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(session, Builders<TDocument>.Filter.Where(filter), field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(session, Builders<TDocument>.Filter.Where(filter), field, value, partitionKey, cancellationToken);\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/BaseMongoRepository.Update.cs",
    "content": "﻿using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n    ///     Its constructor must be given a connection string and a database name.\n    /// </summary>\n    public abstract partial class BaseMongoRepository : IBaseMongoRepository_Update\n    {\n        private IMongoDbUpdater _mongoDbUpdater;\n\n        /// <summary>\n        ///     The MongoDb accessor to update data.\n        /// </summary>\n        protected virtual IMongoDbUpdater MongoDbUpdater\n        {\n            get\n            {\n                if (_mongoDbUpdater != null)\n                {\n                    return _mongoDbUpdater;\n                }\n\n                lock (_initLock)\n                {\n                    if (_mongoDbUpdater == null)\n                    {\n                        _mongoDbUpdater = new MongoDbUpdater(MongoDbContext);\n                    }\n                }\n\n                return _mongoDbUpdater;\n            }\n            set => _mongoDbUpdater = value;\n        }\n\n        #region Update\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument>(TDocument modifiedDocument)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateOneAsync(modifiedDocument, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument>(TDocument modifiedDocument, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, Guid>(modifiedDocument, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument>(TDocument modifiedDocument)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateOne(modifiedDocument, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument>(TDocument modifiedDocument, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, Guid>(modifiedDocument, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument>(TDocument documentToModify, UpdateDefinition<TDocument> update)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateOneAsync(documentToModify, update, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument>(\n            TDocument documentToModify,\n            UpdateDefinition<TDocument> update,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, Guid>(documentToModify, update, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument>(TDocument documentToModify, UpdateDefinition<TDocument> update)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateOne(documentToModify, update, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, Guid>(documentToModify, update, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateOne(documentToModify, field, value, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, Guid, TField>(documentToModify, field, value, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateOneAsync(documentToModify, field, value, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, Guid, TField>(documentToModify, field, value, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateOne(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateOne(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateOne(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, Guid, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateOne(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateOne(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateOne(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, Guid, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateOneAsync(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateOneAsync(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateOneAsync(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, Guid, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateOneAsync(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateOneAsync(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateOneAsync(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, Guid, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateManyAsync(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateManyAsync(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateManyAsync(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await MongoDbUpdater.UpdateManyAsync<TDocument, Guid, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateManyAsync(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateManyAsync(filter, field, value, null, cancellationToken);\n        }\n\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateManyAsync(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await MongoDbUpdater.UpdateManyAsync<TDocument, Guid, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateManyAsync(filter, updateDefinition, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateManyAsync(filter, updateDefinition, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateManyAsync(filter, updateDefinition, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await MongoDbUpdater.UpdateManyAsync<TDocument, Guid>(filter, updateDefinition, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<long> UpdateManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateManyAsync(filter, updateDefinition, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<long> UpdateManyAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateManyAsync(filter, updateDefinition, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<long> UpdateManyAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return await UpdateManyAsync(filter, updateDefinition, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<long> UpdateManyAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return await MongoDbUpdater.UpdateManyAsync<TDocument, Guid>(filter, updateDefinition, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateMany(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateMany(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateMany(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return MongoDbUpdater.UpdateMany<TDocument, Guid, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateMany(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateMany(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateMany(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return MongoDbUpdater.UpdateMany<TDocument, Guid, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateMany(filter, updateDefinition, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateMany(filter, updateDefinition, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateMany(filter, updateDefinition, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return MongoDbUpdater.UpdateMany<TDocument, Guid>(filter, updateDefinition, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public long UpdateMany<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateMany(filter, updateDefinition, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public long UpdateMany<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateMany(filter, updateDefinition, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public long UpdateMany<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)\n            where TDocument : IDocument<Guid>\n        {\n            return UpdateMany(filter, updateDefinition, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public long UpdateMany<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<Guid>\n        {\n            return MongoDbUpdater.UpdateMany<TDocument, Guid>(filter, updateDefinition, partitionKey, cancellationToken);\n        }\n\n        #endregion Update\n\n        #region Update TKey\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument modifiedDocument)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey>(modifiedDocument, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument modifiedDocument, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey>(modifiedDocument, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey>(TDocument modifiedDocument)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey>(modifiedDocument, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey>(TDocument modifiedDocument, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, TKey>(modifiedDocument, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey>(documentToModify, update, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(\n            TDocument documentToModify,\n            UpdateDefinition<TDocument> update,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey>(documentToModify, update, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey>(documentToModify, update, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, TKey>(documentToModify, update, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(documentToModify, field, value, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(documentToModify, field, value, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey, TField>(documentToModify, field, value, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(documentToModify, field, value, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey, TField>(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey, TField>(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey, TField>(Builders<TDocument>.Filter.Where(filter), field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey, TField>(Builders<TDocument>.Filter.Where(filter), field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey, TField>(Builders<TDocument>.Filter.Where(filter), field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(\n                Builders<TDocument>.Filter.Where(filter),\n                field,\n                value,\n                partitionKey,\n                cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateMany<TDocument, TKey, TField>(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateMany<TDocument, TKey, TField>(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateMany<TDocument, TKey, TField>(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateMany<TDocument, TKey, TField>(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateMany<TDocument, TKey>(filter, updateDefinition, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateMany<TDocument, TKey>(filter, updateDefinition, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateMany<TDocument, TKey>(filter, updateDefinition, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbUpdater.UpdateMany<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateMany<TDocument, TKey>(filter, updateDefinition, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateMany<TDocument, TKey>(filter, updateDefinition, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateMany<TDocument, TKey>(filter, updateDefinition, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TKey>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbUpdater.UpdateMany<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);\n        }\n\n        #endregion Update\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/DataAccess/Base/DataAccessBase.cs",
    "content": "﻿using MongoDB.Driver;\nusing MongoDB.Driver.Linq;\nusing MongoDbGenericRepository.Models;\nusing System.Linq.Expressions;\n\nnamespace MongoDbGenericRepository.DataAccess.Base\n{\n    /// <summary>\n    /// A base class for accessing the Database and its Collections.\n    /// </summary>\n    public class DataAccessBase : IDataAccessBase\n    {\n        /// <summary>\n        /// The MongoDbContext\n        /// </summary>\n        protected IMongoDbContext MongoDbContext;\n\n        /// <summary>\n        /// The constructor of the DataAccessBase class\n        /// </summary>\n        /// <param name=\"mongoDbContext\"></param>\n        public DataAccessBase(IMongoDbContext mongoDbContext)\n        {\n            MongoDbContext = mongoDbContext;\n        }\n\n        #region Utility Methods\n\n        /// <summary>\n        /// Gets a IMongoQueryable for a potentially partitioned document type and a filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">The filter definition.</param>\n        /// <param name=\"partitionKey\">The collection partition key.</param>\n        /// <returns></returns>\n#if NETSTANDARD2_0 || NET472\n        public virtual IMongoQueryable<TDocument> GetQuery<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetCollection<TDocument, TKey>(partitionKey).AsQueryable().Where(filter);\n        }\n#endif\n#if NETSTANDARD2_1_OR_GREATER\n        public virtual IQueryable<TDocument> GetQuery<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetCollection<TDocument, TKey>(partitionKey).AsQueryable().Where(filter);\n        }\n#endif\n\n        /// <summary>\n        /// Gets a collections for a potentially partitioned document type.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"document\">The document.</param>\n        /// <returns></returns>\n        public virtual IMongoCollection<TDocument> HandlePartitioned<TDocument, TKey>(TDocument document)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            if (document is IPartitionedDocument)\n            {\n                return GetCollection<TDocument, TKey>(((IPartitionedDocument)document).PartitionKey);\n            }\n            return GetCollection<TDocument, TKey>();\n        }\n\n        /// <summary>\n        /// Gets a collections for the type TDocument with a partition key.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"partitionKey\">The collection partition key.</param>\n        /// <returns></returns>\n        public virtual IMongoCollection<TDocument> GetCollection<TDocument, TKey>(string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbContext.GetCollection<TDocument>(partitionKey);\n        }\n\n        /// <summary>\n        /// Gets a collections for a potentially partitioned document type.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"partitionKey\">The collection partition key.</param>\n        /// <returns></returns>\n        public virtual IMongoCollection<TDocument> HandlePartitioned<TDocument, TKey>(string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            if (!string.IsNullOrEmpty(partitionKey))\n            {\n                return GetCollection<TDocument, TKey>(partitionKey);\n            }\n            return GetCollection<TDocument, TKey>();\n        }\n\n        /// <summary>\n        /// Converts a LINQ expression of TDocument, TValue to a LINQ expression of TDocument, object\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value.</typeparam>\n        /// <param name=\"expression\">The expression to convert</param>\n        protected virtual Expression<Func<TDocument, object>> ConvertExpression<TDocument, TValue>(Expression<Func<TDocument, TValue>> expression)\n        {\n            var param = expression.Parameters[0];\n            Expression body = expression.Body;\n            var convert = Expression.Convert(body, typeof(object));\n            return Expression.Lambda<Func<TDocument, object>>(convert, param);\n        }\n\n        /// <summary>\n        /// Maps a IndexCreationOptions object to a MongoDB.Driver.CreateIndexOptions object\n        /// </summary>\n        /// <param name=\"indexCreationOptions\">The options for creating an index.</param>\n        /// <returns></returns>\n        protected virtual CreateIndexOptions MapIndexOptions(IndexCreationOptions indexCreationOptions)\n        {\n            return new CreateIndexOptions\n            {\n                Unique = indexCreationOptions.Unique,\n                TextIndexVersion = indexCreationOptions.TextIndexVersion,\n                SphereIndexVersion = indexCreationOptions.SphereIndexVersion,\n                Sparse = indexCreationOptions.Sparse,\n                Name = indexCreationOptions.Name,\n                Min = indexCreationOptions.Min,\n                Max = indexCreationOptions.Max,\n                LanguageOverride = indexCreationOptions.LanguageOverride,\n                ExpireAfter = indexCreationOptions.ExpireAfter,\n                DefaultLanguage = indexCreationOptions.DefaultLanguage,\n                Bits = indexCreationOptions.Bits,\n                Background = indexCreationOptions.Background,\n                Version = indexCreationOptions.Version\n            };\n        }\n\n\n        /// <summary>\n        /// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        protected virtual IFindFluent<TDocument, TDocument> GetMinMongoQuery<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey = null)\n                    where TDocument : IDocument<TKey>\n                    where TKey : IEquatable<TKey>\n        {\n            return GetCollection<TDocument, TKey>(partitionKey).Find(Builders<TDocument>.Filter.Where(filter))\n                                                               .SortBy(ConvertExpression(minValueSelector))\n                                                               .Limit(1);\n        }\n\n        /// <summary>\n        /// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by descending.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        protected virtual IFindFluent<TDocument, TDocument> GetMaxMongoQuery<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey = null)\n                    where TDocument : IDocument<TKey>\n                    where TKey : IEquatable<TKey>\n        {\n            return GetCollection<TDocument, TKey>(partitionKey).Find(Builders<TDocument>.Filter.Where(filter))\n                                                               .SortByDescending(ConvertExpression(maxValueSelector))\n                                                               .Limit(1);\n        }\n\n        #endregion\n    }\n}\n"
  },
  {
    "path": "MongoDbGenericRepository/DataAccess/Base/IDataAccessBase.cs",
    "content": "using MongoDB.Driver;\nusing MongoDB.Driver.Linq;\nusing MongoDbGenericRepository.Models;\nusing System.Linq.Expressions;\n\nnamespace MongoDbGenericRepository.DataAccess.Base\n{\n    /// <summary>\n    /// A interface for accessing the Database and its Collections.\n    /// </summary>\n    public interface IDataAccessBase\n    {\n        /// <summary>\n        /// Gets a IMongoQueryable for a potentially partitioned document type and a filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">The filter definition.</param>\n        /// <param name=\"partitionKey\">The collection partition key.</param>\n        /// <returns></returns>\n#if NETSTANDARD2_0 || NET472\n        IMongoQueryable<TDocument> GetQuery<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n#elif NETSTANDARD2_1_OR_GREATER\n        IQueryable<TDocument> GetQuery<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n#endif\n\n        /// <summary>\n        /// Gets a collections for a potentially partitioned document type.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"document\">The document.</param>\n        /// <returns></returns>\n        IMongoCollection<TDocument> HandlePartitioned<TDocument, TKey>(TDocument document)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Gets a collections for a potentially partitioned document type.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"partitionKey\">The collection partition key.</param>\n        /// <returns></returns>\n        IMongoCollection<TDocument> HandlePartitioned<TDocument, TKey>(string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Gets a collections for the type TDocument with a partition key.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"partitionKey\">The collection partition key.</param>\n        /// <returns></returns>\n        IMongoCollection<TDocument> GetCollection<TDocument, TKey>(string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/DataAccess/Create/IMongoDbCreator.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.DataAccess.Base;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository.DataAccess.Create\n{\n    /// <summary>\n    /// A interface for adding documents to the Database and its Collections.\n    /// </summary>\n    public interface IMongoDbCreator : IDataAccessBase\n    {\n        /// <summary>\n        /// Asynchronously adds a document to the collection.\n        /// Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"document\">The document you want to add.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task AddOneAsync<TDocument, TKey>(TDocument document, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Adds a document to the collection.\n        /// Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"document\">The document you want to add.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        void AddOne<TDocument, TKey>(TDocument document, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Asynchronously adds a list of documents to the collection.\n        /// Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documents\">The documents you want to add.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task AddManyAsync<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Adds a list of documents to the collection.\n        /// Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documents\">The documents you want to add.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        void AddMany<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/DataAccess/Create/MongoDbCreator.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.DataAccess.Base;\nusing MongoDbGenericRepository.Models;\nusing MongoDbGenericRepository.Utils;\n\nnamespace MongoDbGenericRepository.DataAccess.Create\n{\n    /// <summary>\n    ///     A class to insert MongoDb document.\n    /// </summary>\n    public class MongoDbCreator : DataAccessBase, IMongoDbCreator\n    {\n        /// <summary>\n        ///     The construct of the MongoDbCreator class.\n        /// </summary>\n        /// <param name=\"mongoDbContext\">A <see cref=\"IMongoDbContext\" /> instance.</param>\n        public MongoDbCreator(IMongoDbContext mongoDbContext) : base(mongoDbContext)\n        {\n        }\n\n        /// <inheritdoc />\n        public virtual async Task AddOneAsync<TDocument, TKey>(TDocument document, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            FormatDocument<TDocument, TKey>(document);\n            await HandlePartitioned<TDocument, TKey>(document)\n                .InsertOneAsync(document, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual void AddOne<TDocument, TKey>(TDocument document, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            FormatDocument<TDocument, TKey>(document);\n            HandlePartitioned<TDocument, TKey>(document)\n                .InsertOne(document, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task AddManyAsync<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var documentsList = documents.ToList();\n\n            if (!documentsList.Any())\n            {\n                return;\n            }\n\n            foreach (var document in documentsList)\n            {\n                FormatDocument<TDocument, TKey>(document);\n            }\n\n            // cannot use typeof(IPartitionedDocument).IsAssignableFrom(typeof(TDocument)), not available in netstandard 1.5\n            if (documentsList.Any(e => e is IPartitionedDocument))\n            {\n                foreach (var group in documentsList.GroupBy(e => ((IPartitionedDocument) e).PartitionKey))\n                {\n                    await HandlePartitioned<TDocument, TKey>(group.FirstOrDefault()).InsertManyAsync(group.ToList(), null, cancellationToken);\n                }\n            }\n            else\n            {\n                await GetCollection<TDocument, TKey>().InsertManyAsync(documentsList, null, cancellationToken);\n            }\n        }\n\n        /// <inheritdoc />\n        public virtual void AddMany<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var documentList = documents.ToList();\n\n            if (!documentList.Any())\n            {\n                return;\n            }\n\n            foreach (var document in documentList)\n            {\n                FormatDocument<TDocument, TKey>(document);\n            }\n\n            // cannot use typeof(IPartitionedDocument).IsAssignableFrom(typeof(TDocument)), not available in netstandard 1.5\n            if (documentList.Any(e => e is IPartitionedDocument))\n            {\n                foreach (var group in documentList.GroupBy(e => ((IPartitionedDocument) e).PartitionKey))\n                {\n                    HandlePartitioned<TDocument, TKey>(group.FirstOrDefault()).InsertMany(group.ToList(), cancellationToken: cancellationToken);\n                }\n            }\n            else\n            {\n                GetCollection<TDocument, TKey>().InsertMany(documentList, cancellationToken: cancellationToken);\n            }\n        }\n\n        /// <summary>\n        ///     Sets the value of the document Id if it is not set already.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"document\">The document.</param>\n        protected void FormatDocument<TDocument, TKey>(TDocument document)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            if (document == null)\n            {\n                throw new ArgumentNullException(nameof(document));\n            }\n\n            var defaultTKey = default(TKey);\n            if (document.Id == null\n                || (defaultTKey != null\n                    && defaultTKey.Equals(document.Id)))\n            {\n                document.Id = IdGenerator.GetId<TKey>();\n            }\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/DataAccess/Delete/IMongoDbEraser.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.DataAccess.Base;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository.DataAccess.Delete\n{\n    /// <summary>\n    /// The MongoDbEraser interface. used to delete documents from the collections.\n    /// </summary>\n    public interface IMongoDbEraser : IDataAccessBase\n    {\n        /// <summary>\n        /// Deletes a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"document\">The document you want to delete.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteOne<TDocument, TKey>(TDocument document, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = default, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Asynchronously deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"document\">The document you want to delete.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteOneAsync<TDocument, TKey>(TDocument document, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Asynchronously deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = default, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Asynchronously deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = default, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Asynchronously deletes a list of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documents\">The list of documents to delete.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteManyAsync<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Deletes a list of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documents\">The list of documents to delete.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteMany<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        /// Deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The Cancellation Token</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = default, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/DataAccess/Delete/MongoDbEraser.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Base;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository.DataAccess.Delete\n{\n    /// <inheritdoc cref=\"MongoDbGenericRepository.DataAccess.Delete.IMongoDbEraser\" />\n    public class MongoDbEraser : DataAccessBase, IMongoDbEraser\n    {\n        /// <summary>\n        ///     The MongoDbEraser constructor.\n        /// </summary>\n        /// <param name=\"mongoDbContext\">the MongoDb Context</param>\n        public MongoDbEraser(IMongoDbContext mongoDbContext) : base(mongoDbContext)\n        {\n        }\n\n        #region Delete TKey\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument, TKey>(TDocument document, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", document.Id);\n            return HandlePartitioned<TDocument, TKey>(document).DeleteOne(filter, cancellationToken).DeletedCount;\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return HandlePartitioned<TDocument, TKey>(partitionKey).DeleteOne(filter, cancellationToken).DeletedCount;\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument, TKey>(TDocument document, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", document.Id);\n            return (await HandlePartitioned<TDocument, TKey>(document).DeleteOneAsync(filter, cancellationToken)).DeletedCount;\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return (await HandlePartitioned<TDocument, TKey>(partitionKey).DeleteOneAsync(filter, cancellationToken)).DeletedCount;\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteManyAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return (await HandlePartitioned<TDocument, TKey>(partitionKey).DeleteManyAsync(filter, cancellationToken)).DeletedCount;\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteManyAsync<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var documentList = documents.ToList();\n\n            if (!documentList.Any())\n            {\n                return 0;\n            }\n\n            // cannot use typeof(IPartitionedDocument).IsAssignableFrom(typeof(TDocument)), not available in netstandard 1.5\n            if (documentList.Any(e => e is IPartitionedDocument))\n            {\n                long deleteCount = 0;\n                foreach (var group in documentList.GroupBy(e => ((IPartitionedDocument) e).PartitionKey))\n                {\n                    var groupIdsToDelete = group.Select(e => e.Id).ToArray();\n                    deleteCount += (await HandlePartitioned<TDocument, TKey>(group.FirstOrDefault())\n                            .DeleteManyAsync(x => groupIdsToDelete.Contains(x.Id), cancellationToken))\n                        .DeletedCount;\n                }\n\n                return deleteCount;\n            }\n\n            var idsToDelete = documentList.Select(e => e.Id).ToArray();\n            return (await HandlePartitioned<TDocument, TKey>(documentList.FirstOrDefault()).DeleteManyAsync(x => idsToDelete.Contains(x.Id), cancellationToken))\n                .DeletedCount;\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var documentList = documents.ToList();\n\n            if (!documentList.Any())\n            {\n                return 0;\n            }\n\n            // cannot use typeof(IPartitionedDocument).IsAssignableFrom(typeof(TDocument)), not available in netstandard 1.5\n            if (documentList.Any(e => e is IPartitionedDocument))\n            {\n                long deleteCount = 0;\n                foreach (var group in documentList.GroupBy(e => ((IPartitionedDocument) e).PartitionKey))\n                {\n                    var groupIdsToDelete = group.Select(e => e.Id).ToArray();\n                    deleteCount += HandlePartitioned<TDocument, TKey>(group.FirstOrDefault()).DeleteMany(x => groupIdsToDelete.Contains(x.Id), cancellationToken).DeletedCount;\n                }\n\n                return deleteCount;\n            }\n\n            var idsToDelete = documentList.Select(e => e.Id).ToArray();\n            return HandlePartitioned<TDocument, TKey>(documentList.FirstOrDefault()).DeleteMany(x => idsToDelete.Contains(x.Id), cancellationToken).DeletedCount;\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return HandlePartitioned<TDocument, TKey>(partitionKey).DeleteMany(filter, cancellationToken).DeletedCount;\n        }\n\n        #endregion\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/DataAccess/Index/IMongoDbIndexHandler.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.DataAccess.Base;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository.DataAccess.Index\n{\n    /// <summary>\n    ///     The MongoDbIndexHandler interface. used to create indexes on collections.\n    /// </summary>\n    public interface IMongoDbIndexHandler : IDataAccessBase\n    {\n        /// <summary>\n        ///     Returns the names of the indexes present on a collection.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"partitionKey\">An optional partition key</param>\n        /// <param name=\"cancellationToken\">An optional Cancellation Token.</param>\n        /// <returns>A list containing the names of the indexes on on the concerned collection.</returns>\n        Task<List<string>> GetIndexesNamesAsync<TDocument, TKey>(string partitionKey = null, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional Cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Drops the index given a field name\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"indexName\">The name of the index</param>\n        /// <param name=\"partitionKey\">An optional partition key</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token,</param>\n        Task DropIndexAsync<TDocument, TKey>(string indexName, string partitionKey = null, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/DataAccess/Index/MongoDbIndexHandler.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Base;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository.DataAccess.Index\n{\n    /// <inheritdoc cref=\"MongoDbGenericRepository.DataAccess.Index.IMongoDbIndexHandler\" />\n    public class MongoDbIndexHandler : DataAccessBase, IMongoDbIndexHandler\n    {\n        /// <summary>\n        ///     The MongoDbIndexHandler constructor.\n        /// </summary>\n        /// <param name=\"mongoDbContext\">The mongo db context</param>\n        public MongoDbIndexHandler(IMongoDbContext mongoDbContext) : base(mongoDbContext)\n        {\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<string>> GetIndexesNamesAsync<TDocument, TKey>(string partitionKey = null, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var indexCursor = await HandlePartitioned<TDocument, TKey>(partitionKey).Indexes.ListAsync(cancellationToken);\n            var indexes = await indexCursor.ToListAsync(cancellationToken);\n            return indexes.Select(e => e[\"name\"].ToString()).ToList();\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var model = new CreateIndexModel<TDocument>(\n                Builders<TDocument>.IndexKeys.Text(field),\n                indexCreationOptions == null ? null : MapIndexOptions(indexCreationOptions)\n            );\n\n            return await HandlePartitioned<TDocument, TKey>(partitionKey).Indexes\n                .CreateOneAsync(\n                    model,\n                    cancellationToken: cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var collection = HandlePartitioned<TDocument, TKey>(partitionKey);\n            var createOptions = indexCreationOptions == null ? null : MapIndexOptions(indexCreationOptions);\n            var indexKey = Builders<TDocument>.IndexKeys;\n            return await\n                collection.Indexes.CreateOneAsync(\n                    new CreateIndexModel<TDocument>(indexKey.Ascending(field), createOptions),\n                    cancellationToken: cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var collection = HandlePartitioned<TDocument, TKey>(partitionKey);\n            var createOptions = indexCreationOptions == null ? null : MapIndexOptions(indexCreationOptions);\n            var indexKey = Builders<TDocument>.IndexKeys;\n            return await collection.Indexes\n                .CreateOneAsync(\n                    new CreateIndexModel<TDocument>(indexKey.Descending(field), createOptions),\n                    cancellationToken: cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var collection = HandlePartitioned<TDocument, TKey>(partitionKey);\n            var createOptions = indexCreationOptions == null ? null : MapIndexOptions(indexCreationOptions);\n            var indexKey = Builders<TDocument>.IndexKeys;\n            return await collection.Indexes\n                .CreateOneAsync(\n                    new CreateIndexModel<TDocument>(indexKey.Hashed(field), createOptions),\n                    cancellationToken: cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var collection = HandlePartitioned<TDocument, TKey>(partitionKey);\n            var createOptions = indexCreationOptions == null ? null : MapIndexOptions(indexCreationOptions);\n            var listOfDefs = new List<IndexKeysDefinition<TDocument>>();\n            foreach (var field in fields)\n            {\n                listOfDefs.Add(Builders<TDocument>.IndexKeys.Text(field));\n            }\n\n            return await collection.Indexes\n                .CreateOneAsync(\n                    new CreateIndexModel<TDocument>(Builders<TDocument>.IndexKeys.Combine(listOfDefs), createOptions),\n                    cancellationToken: cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task DropIndexAsync<TDocument, TKey>(string indexName, string partitionKey = null, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            await HandlePartitioned<TDocument, TKey>(partitionKey).Indexes.DropOneAsync(indexName, cancellationToken);\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/DataAccess/Read/IMongoDbReader.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Base;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository.DataAccess.Read\n{\n    /// <summary>\n    ///     A interface for accessing the Database and its Collections.\n    /// </summary>\n    public interface IMongoDbReader : IDataAccessBase\n    {\n        /// <summary>\n        ///     Asynchronously returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Returns a projected document matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TProjection ProjectOne<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Asynchronously returns a list of projected documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"projection\">The projection expression.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        List<TProjection> ProjectMany<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class;\n\n        /// <summary>\n        ///     Groups a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <param name=\"groupingCriteria\">The grouping criteria.</param>\n        /// <param name=\"groupProjection\">The projected group result.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups filtered a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The grouping criteria.</param>\n        /// <param name=\"projection\">The projected group result.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> selector,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> projection,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Groups filtered a collection of documents given a grouping criteria,\n        ///     and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n        /// <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The grouping criteria.</param>\n        /// <param name=\"projection\">The projected group result.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<List<TProjection>> GroupByAsync<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> selector,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> projection,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new();\n\n        /// <summary>\n        ///     Asynchronously returns a paginated list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"sortSelector\">The property selector.</param>\n        /// <param name=\"ascending\">Order of the sorting.</param>\n        /// <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n        /// <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<List<TDocument>> GetSortedPaginatedAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> sortSelector,\n            bool ascending = true,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a paginated list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"sortDefinition\">The sort definition.</param>\n        /// <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n        /// <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<List<TDocument>> GetSortedPaginatedAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            SortDefinition<TDocument> sortDefinition,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetByIdAsync<TDocument, TKey>(TKey id, string partitionKey = null, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given its id.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"id\">The Id of the document you want to get.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TDocument GetById<TDocument, TKey>(TKey id, string partitionKey = null, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetOneAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetOneAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given filter definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TDocument GetOne<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns one document given an expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TDocument GetOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a collection cursor.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        IFindFluent<TDocument, TDocument> GetCursor<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<bool> AnyAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            CountOptions countOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<bool> AnyAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool Any<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            CountOptions countOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns true if any of the document of the collection matches the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool Any<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<List<TDocument>> GetAllAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"findOption\">A mongodb filter option.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        List<TDocument> GetAll<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns a list of the documents matching the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        List<TDocument> GetAll<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<long> CountAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            CountOptions countOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<long> CountAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"condition\">A mongodb filter definition.</param>\n        /// <param name=\"countOption\">A mongodb counting option.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long Count<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            CountOptions countOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Counts how many documents match the filter condition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long Count<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by descending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetByMaxAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by descending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TDocument GetByMax<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TDocument> GetByMinAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the\n        ///     filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TDocument GetByMin<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the field for which you want the maximum value.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partitionKey.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TValue GetMaxValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        TValue GetMinValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<int> SumByAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task<decimal> SumByAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        int SumBy<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Sums the values of a selected field for a given filtered collection of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"selector\">The field you want to sum.</param>\n        /// <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        decimal SumBy<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/DataAccess/Read/MongoDbReader.GroupBy.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository.DataAccess.Read\n{\n    public partial class MongoDbReader\n    {\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new()\n        {\n            return HandlePartitioned<TDocument, TKey>(partitionKey)\n                .Aggregate()\n                .Group(groupingCriteria, groupProjection)\n                .ToList(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> selector,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> projection,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new()\n        {\n            var collection = HandlePartitioned<TDocument, TKey>(partitionKey);\n            return collection.Aggregate()\n                .Match(Builders<TDocument>.Filter.Where(filter))\n                .Group(selector, projection)\n                .ToList(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TProjection>> GroupByAsync<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> selector,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> projection,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new()\n        {\n            var collection = HandlePartitioned<TDocument, TKey>(partitionKey);\n            return await collection.Aggregate()\n                .Match(Builders<TDocument>.Filter.Where(filter))\n                .Group(selector, projection)\n                .ToListAsync(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TDocument>> GetSortedPaginatedAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> sortSelector,\n            bool ascending = true,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var sorting = ascending\n                ? Builders<TDocument>.Sort.Ascending(sortSelector)\n                : Builders<TDocument>.Sort.Descending(sortSelector);\n\n            return await HandlePartitioned<TDocument, TKey>(partitionKey)\n                .Find(filter)\n                .Sort(sorting)\n                .Skip(skipNumber)\n                .Limit(takeNumber)\n                .ToListAsync(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TDocument>> GetSortedPaginatedAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            SortDefinition<TDocument> sortDefinition,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await HandlePartitioned<TDocument, TKey>(partitionKey)\n                .Find(filter)\n                .Sort(sortDefinition)\n                .Skip(skipNumber)\n                .Limit(takeNumber)\n                .ToListAsync(cancellationToken);\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/DataAccess/Read/MongoDbReader.Main.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDB.Driver.Linq;\nusing MongoDbGenericRepository.DataAccess.Base;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository.DataAccess.Read\n{\n    /// <summary>\n    ///     A class to read MongoDb document.\n    /// </summary>\n    public partial class MongoDbReader : DataAccessBase, IMongoDbReader\n    {\n        /// <summary>\n        ///     The construct of the MongoDbReader class.\n        /// </summary>\n        /// <param name=\"mongoDbContext\">A <see cref=\"IMongoDbContext\" /> instance.</param>\n        public MongoDbReader(IMongoDbContext mongoDbContext) : base(mongoDbContext)\n        {\n        }\n\n        #region Read TKey\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetByIdAsync<TDocument, TKey>(TKey id, string partitionKey = null, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", id);\n            return await HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter).FirstOrDefaultAsync(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetById<TDocument, TKey>(TKey id, string partitionKey = null, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", id);\n            return HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter).FirstOrDefault(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual Task<TDocument> GetOneAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return HandlePartitioned<TDocument, TKey>(partitionKey).Find(condition, findOption).FirstOrDefaultAsync(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetOne<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return HandlePartitioned<TDocument, TKey>(partitionKey).Find(condition, findOption).FirstOrDefault(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetOneAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter).FirstOrDefaultAsync(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetOne<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter).FirstOrDefault(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual IFindFluent<TDocument, TDocument> GetCursor<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> AnyAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            CountOptions countOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var count = await HandlePartitioned<TDocument, TKey>(partitionKey).CountDocumentsAsync(condition, countOption, cancellationToken);\n            return count > 0;\n        }\n\n        /// <inheritdoc />\n        public virtual bool Any<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            CountOptions countOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var count = HandlePartitioned<TDocument, TKey>(partitionKey).CountDocuments(condition, countOption, cancellationToken);\n            return count > 0;\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> AnyAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var count = await HandlePartitioned<TDocument, TKey>(partitionKey).CountDocumentsAsync(filter, cancellationToken: cancellationToken);\n            return count > 0;\n        }\n\n        /// <inheritdoc />\n        public virtual bool Any<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var count = HandlePartitioned<TDocument, TKey>(partitionKey).CountDocuments(filter, cancellationToken: cancellationToken);\n            return count > 0;\n        }\n\n        /// <inheritdoc />\n        public virtual Task<List<TDocument>> GetAllAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return HandlePartitioned<TDocument, TKey>(partitionKey).Find(condition, findOption).ToListAsync(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TDocument> GetAll<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return HandlePartitioned<TDocument, TKey>(partitionKey).Find(condition, findOption).ToList(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TDocument>> GetAllAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter).ToListAsync(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TDocument> GetAll<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter).ToList(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual Task<long> CountAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            CountOptions countOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return HandlePartitioned<TDocument, TKey>(partitionKey).CountDocumentsAsync(condition, countOption, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long Count<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            CountOptions countOption = null,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return HandlePartitioned<TDocument, TKey>(partitionKey).CountDocuments(condition, countOption, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> CountAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await HandlePartitioned<TDocument, TKey>(partitionKey).CountDocumentsAsync(filter, cancellationToken: cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long Count<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter).CountDocuments(cancellationToken);\n        }\n\n        #endregion\n\n        #region Min / Max\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetByMaxAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetCollection<TDocument, TKey>(partitionKey).Find(Builders<TDocument>.Filter.Where(filter))\n                .SortByDescending(maxValueSelector)\n                .Limit(1)\n                .FirstOrDefaultAsync(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetByMax<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetCollection<TDocument, TKey>(partitionKey).Find(Builders<TDocument>.Filter.Where(filter))\n                .SortByDescending(maxValueSelector)\n                .Limit(1)\n                .FirstOrDefault(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetByMinAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetCollection<TDocument, TKey>(partitionKey).Find(Builders<TDocument>.Filter.Where(filter))\n                .SortBy(minValueSelector)\n                .Limit(1)\n                .FirstOrDefaultAsync(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetByMin<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetCollection<TDocument, TKey>(partitionKey).Find(Builders<TDocument>.Filter.Where(filter))\n                .SortBy(minValueSelector)\n                .Limit(1)\n                .FirstOrDefault(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetMaxMongoQuery<TDocument, TKey, TValue>(filter, maxValueSelector, partitionKey)\n                .Project(maxValueSelector)\n                .FirstOrDefaultAsync(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TValue GetMaxValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetMaxMongoQuery<TDocument, TKey, TValue>(filter, maxValueSelector, partitionKey)\n                .Project(maxValueSelector)\n                .FirstOrDefault(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetMinMongoQuery<TDocument, TKey, TValue>(filter, minValueSelector, partitionKey).Project(minValueSelector)\n                .FirstOrDefaultAsync(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TValue GetMinValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetMinMongoQuery<TDocument, TKey, TValue>(filter, minValueSelector, partitionKey).Project(minValueSelector)\n                .FirstOrDefault(cancellationToken);\n        }\n\n        #endregion Min / Max\n\n        #region Sum TKey\n\n        /// <inheritdoc />\n        public virtual async Task<int> SumByAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetQuery<TDocument, TKey>(filter, partitionKey).SumAsync(selector, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual int SumBy<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetQuery<TDocument, TKey>(filter, partitionKey).Sum(selector);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<decimal> SumByAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetQuery<TDocument, TKey>(filter, partitionKey).SumAsync(selector, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual decimal SumBy<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetQuery<TDocument, TKey>(filter, partitionKey).Sum(selector);\n        }\n\n        #endregion Sum TKey\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/DataAccess/Read/MongoDbReader.Project.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository.DataAccess.Read\n{\n    public partial class MongoDbReader\n    {\n        /// <inheritdoc />\n        public virtual async Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return await HandlePartitioned<TDocument, TKey>(partitionKey)\n                .Find(filter)\n                .Project(projection)\n                .FirstOrDefaultAsync(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return await HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter)\n                .Project(projection)\n                .ToListAsync(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TProjection ProjectOne<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter)\n                .Project(projection)\n                .FirstOrDefault(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> ProjectMany<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter)\n                .Project(projection)\n                .ToList(cancellationToken);\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/DataAccess/Update/IMongoDbUpdater.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Base;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository.DataAccess.Update\n{\n    /// <summary>\n    ///     A interface for updating documents in MongoDb.\n    /// </summary>\n    public interface IMongoDbUpdater : IDataAccessBase\n    {\n        /// <summary>\n        ///     Asynchronously Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument modifiedDocument, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Takes a document you want to modify and applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"update\">The update definition for the document.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey>(\n            TDocument documentToModify,\n            UpdateDefinition<TDocument> update,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     For the entity selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns></returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"documentToModify\">The document to modify.</param>\n        /// <param name=\"update\">The update definition.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns></returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            UpdateDefinition<TDocument> update,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"documentToModify\">The document to modify.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns></returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"partitionKey\">The optional partition key.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns></returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"partitionKey\">The optional partition key.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns></returns>\n        Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        bool UpdateOne<TDocument, TKey>(TDocument modifiedDocument, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Takes a document you want to modify and applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"update\">The update definition for the document.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        bool UpdateOne<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        bool UpdateOne<TDocument, TKey, TField>(\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        bool UpdateOne<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     For the entity selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        bool UpdateOne<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns></returns>\n        bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"documentToModify\">The document to modify.</param>\n        /// <param name=\"update\">The update definition.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns></returns>\n        bool UpdateOne<TDocument, TKey>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            UpdateDefinition<TDocument> update,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"documentToModify\">The document to modify.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns></returns>\n        bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"partitionKey\">The optional partition key.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns></returns>\n        bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field to update.</typeparam>\n        /// <param name=\"session\">The client session.</param>\n        /// <param name=\"filter\">The filter for the update.</param>\n        /// <param name=\"field\">The field to update.</param>\n        /// <param name=\"value\">The value of the field.</param>\n        /// <param name=\"partitionKey\">The optional partition key.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        /// <returns></returns>\n        bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, apply the update definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"update\">the update definition</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> update,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, apply the update definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        long UpdateMany<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        long UpdateMany<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, apply the update definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        long UpdateMany<TDocument, TKey>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, apply the update definition.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The optional cancellation token.</param>\n        long UpdateMany<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/DataAccess/Update/MongoDbUpdater.ClientSession.cs",
    "content": "﻿using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository.DataAccess.Update\n{\n    public partial class MongoDbUpdater\n    {\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(\n            IClientSessionHandle session,\n            TDocument modifiedDocument,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", modifiedDocument.Id);\n            var updateRes = await HandlePartitioned<TDocument, TKey>(modifiedDocument)\n                .ReplaceOneAsync(session, filter, modifiedDocument, cancellationToken: cancellationToken)\n                .ConfigureAwait(false);\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", modifiedDocument.Id);\n            var updateRes = HandlePartitioned<TDocument, TKey>(modifiedDocument)\n                .ReplaceOne(session, filter, modifiedDocument, cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            UpdateDefinition<TDocument> update,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", documentToModify.Id);\n            var updateRes = await HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOneAsync(session, filter, update, null, cancellationToken)\n                .ConfigureAwait(false);\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual bool UpdateOne<TDocument, TKey>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            UpdateDefinition<TDocument> update,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", documentToModify.Id);\n            var updateRes = HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOne(session, filter, update, null, cancellationToken);\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", documentToModify.Id);\n            var updateRes = await HandlePartitioned<TDocument, TKey>(documentToModify)\n                .UpdateOneAsync(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken)\n                .ConfigureAwait(false);\n\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", documentToModify.Id);\n            var updateRes = HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOne(\n                session,\n                filter,\n                Builders<TDocument>.Update.Set(field, value),\n                cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey);\n            var updateRes = await collection.UpdateOneAsync(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken)\n                .ConfigureAwait(false);\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOneAsync<TDocument, TKey, TField>(session, Builders<TDocument>.Filter.Where(filter), field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey);\n            var updateRes = collection.UpdateOne(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            IClientSessionHandle session,\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(session, Builders<TDocument>.Filter.Where(filter), field, value, partitionKey, cancellationToken);\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/DataAccess/Update/MongoDbUpdater.cs",
    "content": "﻿using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Base;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository.DataAccess.Update\n{\n    /// <summary>\n    ///     The MongoDb updater.\n    /// </summary>\n    public partial class MongoDbUpdater : DataAccessBase, IMongoDbUpdater\n    {\n        /// <summary>\n        ///     Constructor\n        /// </summary>\n        /// <param name=\"mongoDbContext\"></param>\n        public MongoDbUpdater(IMongoDbContext mongoDbContext) : base(mongoDbContext)\n        {\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument modifiedDocument, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", modifiedDocument.Id);\n            var updateRes = await HandlePartitioned<TDocument, TKey>(modifiedDocument)\n                .ReplaceOneAsync(filter, modifiedDocument, cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual bool UpdateOne<TDocument, TKey>(TDocument modifiedDocument, CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", modifiedDocument.Id);\n            var updateRes = HandlePartitioned<TDocument, TKey>(modifiedDocument).ReplaceOne(filter, modifiedDocument, cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(\n            TDocument documentToModify,\n            UpdateDefinition<TDocument> update,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", documentToModify.Id);\n            var updateRes = await HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOneAsync(filter, update, cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual bool UpdateOne<TDocument, TKey>(\n            TDocument documentToModify,\n            UpdateDefinition<TDocument> update,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", documentToModify.Id);\n            var updateRes = HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOne(filter, update, cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", documentToModify.Id);\n            var updateRes = await HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOneAsync(\n                filter,\n                Builders<TDocument>.Update.Set(field, value),\n                cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var filter = Builders<TDocument>.Filter.Eq(\"Id\", documentToModify.Id);\n            var updateRes = HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOne(\n                filter,\n                Builders<TDocument>.Update.Set(field, value),\n                cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey);\n            var updateRes = await collection.UpdateOneAsync(filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateOneAsync<TDocument, TKey, TField>(Builders<TDocument>.Filter.Where(filter), field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey);\n            var updateRes = collection.UpdateOne(filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount == 1;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual bool UpdateOne<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateOne<TDocument, TKey, TField>(Builders<TDocument>.Filter.Where(filter), field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateManyAsync<TDocument, TKey, TField>(Builders<TDocument>.Filter.Where(filter), field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey);\n            var updateRes = await collection.UpdateManyAsync(filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> update,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await UpdateManyAsync<TDocument, TKey>(Builders<TDocument>.Filter.Where(filter), update, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey);\n            var updateRes = await collection.UpdateManyAsync(filter, updateDefinition, cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual long UpdateMany<TDocument, TKey, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return UpdateMany<TDocument, TKey, TField>(Builders<TDocument>.Filter.Where(filter), field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual long UpdateMany<TDocument, TKey, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey);\n            var updateRes = collection.UpdateMany(filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual long UpdateMany<TDocument, TKey>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey);\n            var updateRes = collection.UpdateMany(filter, updateDefinition, cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount;\n        }\n\n        /// <inheritdoc cref=\"IMongoDbUpdater\" />\n        public virtual long UpdateMany<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey);\n            var updateRes = collection.UpdateMany(filter, updateDefinition, cancellationToken: cancellationToken);\n            return updateRes.ModifiedCount;\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/IBaseMongoRepository.Create.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The IBaseMongoRepository_Create interface to expose document creation functionality\n    ///     with document having an Id of type Guid.\n    /// </summary>\n    public interface IBaseMongoRepository_Create : IBaseMongoRepository_Create<Guid>\n    {\n        /// <summary>\n        ///     Asynchronously adds a document to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"document\">The document you want to add.</param>\n        Task AddOneAsync<TDocument, TKey>(TDocument document)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously adds a document to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"document\">The document you want to add.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task AddOneAsync<TDocument, TKey>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Adds a document to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"document\">The document you want to add.</param>\n        void AddOne<TDocument, TKey>(TDocument document)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Adds a document to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"document\">The document you want to add.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        void AddOne<TDocument, TKey>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously adds a list of documents to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documents\">The documents you want to add.</param>\n        Task AddManyAsync<TDocument, TKey>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously adds a list of documents to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documents\">The documents you want to add.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task AddManyAsync<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Adds a list of documents to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documents\">The documents you want to add.</param>\n        void AddMany<TDocument, TKey>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Adds a list of documents to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documents\">The documents you want to add.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        void AddMany<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/IBaseMongoRepository.Delete.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The base Mongo Repository Delete interface. used to delete documents from the collections.\n    /// </summary>\n    public interface IBaseMongoRepository_Delete : IBaseMongoRepository_Delete<Guid>\n    {\n        /// <summary>\n        ///     Deletes a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"document\">The document you want to delete.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteOne<TDocument, TKey>(TDocument document)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Deletes a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"document\">The document you want to delete.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteOne<TDocument, TKey>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"document\">The document you want to delete.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteOneAsync<TDocument, TKey>(TDocument document)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"document\">The document you want to delete.</param>\n        /// <param name=\"cancellationToken\">The Cancellation token</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteOneAsync<TDocument, TKey>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes a list of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documents\">The list of documents to delete.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteManyAsync<TDocument, TKey>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes a list of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documents\">The list of documents to delete.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteManyAsync<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Deletes a list of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documents\">The list of documents to delete.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteMany<TDocument, TKey>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Deletes a list of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"documents\">The list of documents to delete.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteMany<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n\n        /// <summary>\n        ///     Deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/IBaseMongoRepository.Index.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The interface exposing index management functionality for Guid Keyed repositories.\n    /// </summary>\n    public interface IBaseMongoRepository_Index : IBaseMongoRepository_Index<Guid>\n    {\n        /// <summary>\n        ///     Returns the names of the indexes present on a collection.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <returns>A list containing the names of the indexes on on the concerned collection.</returns>\n        Task<List<string>> GetIndexesNamesAsync<TDocument, TKey>()\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns the names of the indexes present on a collection.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        /// <returns>A list containing the names of the indexes on on the concerned collection.</returns>\n        Task<List<string>> GetIndexesNamesAsync<TDocument, TKey>(CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns the names of the indexes present on a collection.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"partitionKey\">An optional partition key</param>\n        /// <returns>A list containing the names of the indexes on on the concerned collection.</returns>\n        Task<List<string>> GetIndexesNamesAsync<TDocument, TKey>(string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Returns the names of the indexes present on a collection.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"partitionKey\">An optional partition key</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        /// <returns>A list containing the names of the indexes on on the concerned collection.</returns>\n        Task<List<string>> GetIndexesNamesAsync<TDocument, TKey>(string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument, TKey>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Drops the index given a field name\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"indexName\">The name of the index</param>\n        Task DropIndexAsync<TDocument, TKey>(string indexName)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Drops the index given a field name\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"indexName\">The name of the index</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        Task DropIndexAsync<TDocument, TKey>(string indexName, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Drops the index given a field name\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"indexName\">The name of the index</param>\n        /// <param name=\"partitionKey\">An optional partition key</param>\n        Task DropIndexAsync<TDocument, TKey>(string indexName, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n\n        /// <summary>\n        ///     Drops the index given a field name\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n        /// <param name=\"indexName\">The name of the index</param>\n        /// <param name=\"partitionKey\">An optional partition key</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        Task DropIndexAsync<TDocument, TKey>(string indexName, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/Internals/RepositorySerializationProvider.cs",
    "content": "﻿using System;\nusing System.Collections.Concurrent;\nusing MongoDB.Bson.Serialization;\n\nnamespace MongoDbGenericRepository.Internals\n{\n    /// <summary>\n    /// An <see cref=\"IBsonSerializationProvider\"/> that can handle multiple serializer registration calls.\n    /// </summary>\n    internal class RepositorySerializationProvider : IBsonSerializationProvider\n    {\n        private static volatile RepositorySerializationProvider _instance;\n        private static readonly object LockObject = new object();\n\n        private readonly ConcurrentDictionary<Type, IBsonSerializer> _cache;\n\n        private RepositorySerializationProvider()\n        {\n            _cache = new ConcurrentDictionary<Type, IBsonSerializer>();\n        }\n\n        public static RepositorySerializationProvider Instance\n        {\n            get\n            {\n                if (_instance == null)\n                {\n                    lock (LockObject)\n                    {\n                        if (_instance == null)\n                        {\n                            _instance = new RepositorySerializationProvider();\n                            BsonSerializer.RegisterSerializationProvider(_instance);\n                        }\n                    }\n                }\n\n                return _instance;\n            }\n        }\n\n        /// <inheritdoc />\n        public IBsonSerializer GetSerializer(Type type)\n        {\n            if (type == null)\n            {\n                throw new ArgumentNullException(nameof(type));\n            }\n\n            return _cache.TryGetValue(type, out var serializer) ? serializer : null;\n        }\n\n        internal void RegisterSerializer<T>(IBsonSerializer<T> serializer) =>\n            RegisterSerializer(typeof(T), serializer);\n\n        internal void RegisterSerializer(Type type, IBsonSerializer serializer) =>\n            _cache.TryAdd(type, serializer);\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/KeyTypedRepository/BaseMongoRepository.TKey.Create.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.DataAccess.Create;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n    ///     Its constructor must be given a connection string and a database name.\n    /// </summary>\n    public abstract partial class BaseMongoRepository<TKey> : IBaseMongoRepository_Create<TKey>\n        where TKey : IEquatable<TKey>\n    {\n        private IMongoDbCreator _mongoDbCreator;\n\n        /// <summary>\n        ///     The MongoDb accessor to insert data.\n        /// </summary>\n        protected virtual IMongoDbCreator MongoDbCreator\n        {\n            get\n            {\n                if (_mongoDbCreator == null)\n                {\n                    lock (_initLock)\n                    {\n                        if (_mongoDbCreator == null)\n                        {\n                            _mongoDbCreator = new MongoDbCreator(MongoDbContext);\n                        }\n                    }\n                }\n\n                return _mongoDbCreator;\n            }\n\n            set => _mongoDbCreator = value;\n        }\n\n        /// <inheritdoc />\n        public virtual async Task AddOneAsync<TDocument>(TDocument document)\n            where TDocument : IDocument<TKey>\n        {\n            await AddOneAsync(document, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task AddOneAsync<TDocument>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            await MongoDbCreator.AddOneAsync<TDocument, TKey>(document, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual void AddOne<TDocument>(TDocument document)\n            where TDocument : IDocument<TKey>\n        {\n            AddOne(document, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual void AddOne<TDocument>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            MongoDbCreator.AddOne<TDocument, TKey>(document, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task AddManyAsync<TDocument>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>\n        {\n            await AddManyAsync(documents, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task AddManyAsync<TDocument>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            await MongoDbCreator.AddManyAsync<TDocument, TKey>(documents, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual void AddMany<TDocument>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>\n        {\n            AddMany(documents, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual void AddMany<TDocument>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            MongoDbCreator.AddMany<TDocument, TKey>(documents, cancellationToken);\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/KeyTypedRepository/BaseMongoRepository.TKey.Delete.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.DataAccess.Delete;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    public abstract partial class BaseMongoRepository<TKey> : IBaseMongoRepository_Delete<TKey>\n        where TKey : IEquatable<TKey>\n    {\n        private IMongoDbEraser _mongoDbEraser;\n\n        /// <summary>\n        ///     The MongoDb accessor to delete data.\n        /// </summary>\n        protected virtual IMongoDbEraser MongoDbEraser\n        {\n            get\n            {\n                if (_mongoDbEraser != null)\n                {\n                    return _mongoDbEraser;\n                }\n\n                lock (_initLock)\n                {\n                    if (_mongoDbEraser == null)\n                    {\n                        _mongoDbEraser = new MongoDbEraser(MongoDbContext);\n                    }\n                }\n\n                return _mongoDbEraser;\n            }\n            set => _mongoDbEraser = value;\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument>(TDocument document)\n            where TDocument : IDocument<TKey>\n        {\n            return DeleteOne(document, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbEraser.DeleteOne<TDocument, TKey>(document, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n        {\n            return DeleteOne(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return DeleteOne(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return DeleteOne(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteOne<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbEraser.DeleteOne<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument>(TDocument document)\n            where TDocument : IDocument<TKey>\n        {\n            return await DeleteOneAsync(document, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbEraser.DeleteOneAsync<TDocument, TKey>(document, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n        {\n            return await DeleteOneAsync(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await DeleteOneAsync(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await DeleteOneAsync(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteOneAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbEraser.DeleteOneAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteManyAsync<TDocument>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>\n        {\n            return await DeleteManyAsync(documents, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteManyAsync<TDocument>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbEraser.DeleteManyAsync<TDocument, TKey>(documents, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<long> DeleteManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n        {\n            return await DeleteManyAsync(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<long> DeleteManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await DeleteManyAsync(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await DeleteManyAsync(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> DeleteManyAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbEraser.DeleteManyAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>\n        {\n            return DeleteMany(documents, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbEraser.DeleteMany<TDocument, TKey>(documents, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n        {\n            return DeleteMany(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return DeleteMany(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return DeleteMany(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbEraser.DeleteMany<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/KeyTypedRepository/BaseMongoRepository.TKey.Index.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.DataAccess.Index;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n    ///     Its constructor must be given a connection string and a database name.\n    /// </summary>\n    public abstract partial class BaseMongoRepository<TKey> : IBaseMongoRepository_Index<TKey>\n        where TKey : IEquatable<TKey>\n    {\n        private IMongoDbIndexHandler _mongoDbIndexHandler;\n\n        /// <summary>\n        ///     The MongoDb accessor to manage indexes.\n        /// </summary>\n        protected virtual IMongoDbIndexHandler MongoDbIndexHandler\n        {\n            get\n            {\n                if (_mongoDbIndexHandler != null)\n                {\n                    return _mongoDbIndexHandler;\n                }\n\n                lock (_initLock)\n                {\n                    if (_mongoDbIndexHandler == null)\n                    {\n                        _mongoDbIndexHandler = new MongoDbIndexHandler(MongoDbContext);\n                    }\n                }\n\n                return _mongoDbIndexHandler;\n            }\n            set => _mongoDbIndexHandler = value;\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<string>> GetIndexesNamesAsync<TDocument>()\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbIndexHandler.GetIndexesNamesAsync<TDocument, TKey>();\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<string>> GetIndexesNamesAsync<TDocument>(CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbIndexHandler.GetIndexesNamesAsync<TDocument, TKey>(cancellationToken: cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<string>> GetIndexesNamesAsync<TDocument>(string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbIndexHandler.GetIndexesNamesAsync<TDocument, TKey>(partitionKey);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<string>> GetIndexesNamesAsync<TDocument>(string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbIndexHandler.GetIndexesNamesAsync<TDocument, TKey>(partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateTextIndexAsync(field, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateTextIndexAsync(field, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateTextIndexAsync(field, indexCreationOptions, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateTextIndexAsync(field, indexCreationOptions, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateTextIndexAsync(field, indexCreationOptions, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateTextIndexAsync(field, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateTextIndexAsync(field, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateTextIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbIndexHandler.CreateTextIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateAscendingIndexAsync(field, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateAscendingIndexAsync(field, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateAscendingIndexAsync(field, indexCreationOptions, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateAscendingIndexAsync(field, indexCreationOptions, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateAscendingIndexAsync(field, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateAscendingIndexAsync(field, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateAscendingIndexAsync(field, indexCreationOptions, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbIndexHandler.CreateAscendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateDescendingIndexAsync(field, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateDescendingIndexAsync(field, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateDescendingIndexAsync(field, indexCreationOptions, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateDescendingIndexAsync(field, indexCreationOptions, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateDescendingIndexAsync(field, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateDescendingIndexAsync(field, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateDescendingIndexAsync(field, indexCreationOptions, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbIndexHandler.CreateDescendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateHashedIndexAsync(field, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateHashedIndexAsync(field, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateHashedIndexAsync(field, indexCreationOptions, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateHashedIndexAsync(field, indexCreationOptions, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateHashedIndexAsync(field, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateHashedIndexAsync(field, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateHashedIndexAsync(field, indexCreationOptions, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateHashedIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbIndexHandler.CreateHashedIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateCombinedTextIndexAsync(fields, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateCombinedTextIndexAsync(fields, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateCombinedTextIndexAsync(fields, indexCreationOptions, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateCombinedTextIndexAsync(fields, indexCreationOptions, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateCombinedTextIndexAsync(fields, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateCombinedTextIndexAsync(fields, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await CreateCombinedTextIndexAsync(fields, indexCreationOptions, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbIndexHandler.CreateCombinedTextIndexAsync<TDocument, TKey>(fields, indexCreationOptions, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task DropIndexAsync<TDocument>(string indexName)\n            where TDocument : IDocument<TKey>\n        {\n            await DropIndexAsync<TDocument>(indexName, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task DropIndexAsync<TDocument>(string indexName, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            await DropIndexAsync<TDocument>(indexName, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task DropIndexAsync<TDocument>(string indexName, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            await DropIndexAsync<TDocument>(indexName, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task DropIndexAsync<TDocument>(string indexName, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            await MongoDbIndexHandler.DropIndexAsync<TDocument, TKey>(indexName, partitionKey, cancellationToken);\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/KeyTypedRepository/BaseMongoRepository.TKey.Main.cs",
    "content": "﻿using System;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n    ///     Its constructor must be given a connection string and a database name.\n    /// </summary>\n    /// <typeparam name=\"TKey\">The type of the document Id.</typeparam>\n    public abstract partial class BaseMongoRepository<TKey> :\n        ReadOnlyMongoRepository<TKey>,\n        IBaseMongoRepository<TKey>\n        where TKey : IEquatable<TKey>\n    {\n        private readonly object _initLock = new object();\n\n        /// <summary>\n        ///     The constructor taking a connection string and a database name.\n        /// </summary>\n        /// <param name=\"connectionString\">The connection string of the MongoDb server.</param>\n        /// <param name=\"databaseName\">The name of the database against which you want to perform operations.</param>\n        protected BaseMongoRepository(string connectionString, string databaseName = null) : base(connectionString, databaseName)\n        {\n        }\n\n        /// <summary>\n        ///     The constructor taking a <see cref=\"IMongoDbContext\" />.\n        /// </summary>\n        /// <param name=\"mongoDbContext\">A mongodb context implementing <see cref=\"IMongoDbContext\" /></param>\n        protected BaseMongoRepository(IMongoDbContext mongoDbContext) : base(mongoDbContext)\n        {\n        }\n\n        /// <summary>\n        ///     The constructor taking a <see cref=\"IMongoDatabase\" />.\n        /// </summary>\n        /// <param name=\"mongoDatabase\">A mongodb context implementing <see cref=\"IMongoDatabase\" /></param>\n        protected BaseMongoRepository(IMongoDatabase mongoDatabase) : base(mongoDatabase)\n        {\n        }\n\n        /// <summary>\n        ///     Gets a collections for a potentially partitioned document type.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"partitionKey\">The collection partition key.</param>\n        /// <returns></returns>\n        protected virtual IMongoCollection<TDocument> HandlePartitioned<TDocument>(string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            if (!string.IsNullOrEmpty(partitionKey))\n            {\n                return GetCollection<TDocument>(partitionKey);\n            }\n\n            return GetCollection<TDocument>();\n        }\n\n        /// <summary>\n        ///     Gets a collections for the type TDocument with a partition key.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"partitionKey\">The collection partition key.</param>\n        /// <returns></returns>\n        protected virtual IMongoCollection<TDocument> GetCollection<TDocument>(string partitionKey = null)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbContext.GetCollection<TDocument>(partitionKey);\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/KeyTypedRepository/BaseMongoRepository.TKey.ReadOnly.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Read;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n    ///     Its constructor must be given a connection string and a database name.\n    /// </summary>\n    public abstract class ReadOnlyMongoRepository<TKey> : IReadOnlyMongoRepository<TKey>\n        where TKey : IEquatable<TKey>\n    {\n        /// <summary>\n        ///     The constructor taking a connection string and a database name.\n        /// </summary>\n        /// <param name=\"connectionString\">The connection string of the MongoDb server.</param>\n        /// <param name=\"databaseName\">The name of the database against which you want to perform operations.</param>\n        protected ReadOnlyMongoRepository(string connectionString, string databaseName = null)\n        {\n            SetupMongoDbContext(connectionString, databaseName);\n        }\n\n        /// <summary>\n        ///     The constructor taking a <see cref=\"IMongoDatabase\" />.\n        /// </summary>\n        /// <param name=\"mongoDatabase\">A mongodb context implementing <see cref=\"IMongoDatabase\" /></param>\n        protected ReadOnlyMongoRepository(IMongoDatabase mongoDatabase)\n            : this(new MongoDbContext(mongoDatabase))\n        {\n        }\n\n        /// <summary>\n        ///     The constructor taking a <see cref=\"IMongoDbContext\" />.\n        /// </summary>\n        /// <param name=\"mongoDbContext\">A mongodb context implementing <see cref=\"IMongoDbContext\" /></param>\n        protected ReadOnlyMongoRepository(IMongoDbContext mongoDbContext)\n        {\n            SetupMongoDbContext(mongoDbContext);\n        }\n\n        /// <summary>\n        ///     The MongoDbContext\n        /// </summary>\n        protected IMongoDbContext MongoDbContext { get; set; }\n\n        /// <summary>\n        ///     A MongoDb Reader for read operations\n        /// </summary>\n        protected IMongoDbReader MongoDbReader { get; set; }\n\n        /// <summary>\n        ///     The connection string.\n        /// </summary>\n        public string ConnectionString { get; protected set; }\n\n        /// <summary>\n        ///     The database name.\n        /// </summary>\n        public string DatabaseName { get; protected set; }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new()\n        {\n            return GroupBy(groupingCriteria, groupProjection, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new()\n        {\n            return GroupBy(groupingCriteria, groupProjection, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new()\n        {\n            return GroupBy(groupingCriteria, groupProjection, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new()\n        {\n            return MongoDbReader.GroupBy<TDocument, TGroupKey, TProjection, TKey>(groupingCriteria, groupProjection, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new()\n        {\n            return GroupBy(filter, groupingCriteria, groupProjection, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new()\n        {\n            return GroupBy(filter, groupingCriteria, groupProjection, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new()\n        {\n            return GroupBy(filter, groupingCriteria, groupProjection, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class, new()\n        {\n            return MongoDbReader.GroupBy<TDocument, TGroupKey, TProjection, TKey>(filter, groupingCriteria, groupProjection, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TDocument>> GetSortedPaginatedAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> sortSelector,\n            bool ascending = true,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbReader.GetSortedPaginatedAsync<TDocument, TKey>(\n                filter,\n                sortSelector,\n                ascending,\n                skipNumber,\n                takeNumber,\n                partitionKey,\n                cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TDocument>> GetSortedPaginatedAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            SortDefinition<TDocument> sortDefinition,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbReader.GetSortedPaginatedAsync<TDocument, TKey>(\n                filter,\n                sortDefinition,\n                skipNumber,\n                takeNumber,\n                partitionKey,\n                cancellationToken);\n        }\n\n        /// <summary>\n        ///     Setups the repository with a <see cref=\"IMongoDbContext\" />.\n        /// </summary>\n        /// <param name=\"mongoDbContext\"></param>\n        protected void SetupMongoDbContext(IMongoDbContext mongoDbContext)\n        {\n            MongoDbContext = MongoDbContext ?? mongoDbContext;\n            MongoDbReader = MongoDbReader ?? new MongoDbReader(MongoDbContext);\n        }\n\n        /// <summary>\n        ///     Setups the repository with a connection string and a database name.\n        /// </summary>\n        /// <param name=\"connectionString\"></param>\n        /// <param name=\"databaseName\">\n        ///     The database name. If the database name is null or whitespace it is taken from the\n        ///     connection string\n        /// </param>\n        protected void SetupMongoDbContext(string connectionString, string databaseName)\n        {\n            if (string.IsNullOrWhiteSpace(databaseName))\n            {\n                var mongoUrl = new MongoUrl(connectionString);\n                databaseName = mongoUrl.DatabaseName;\n            }\n\n            ConnectionString = connectionString;\n            DatabaseName = databaseName;\n            SetupMongoDbContext(new MongoDbContext(connectionString, databaseName));\n        }\n\n        #region Read\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetByIdAsync<TDocument>(TKey id)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetByIdAsync<TDocument>(id, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetByIdAsync<TDocument>(TKey id, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetByIdAsync<TDocument>(id, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetByIdAsync<TDocument>(TKey id, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetByIdAsync<TDocument>(id, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetByIdAsync<TDocument>(TKey id, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbReader.GetByIdAsync<TDocument, TKey>(id, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetById<TDocument>(TKey id)\n            where TDocument : IDocument<TKey>\n        {\n            return GetById<TDocument>(id, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetById<TDocument>(TKey id, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return GetById<TDocument>(id, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetById<TDocument>(TKey id, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return GetById<TDocument>(id, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetById<TDocument>(TKey id, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbReader.GetById<TDocument, TKey>(id, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetOneAsync(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetOneAsync(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetOneAsync(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbReader.GetOneAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetOne<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n        {\n            return GetOne(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetOne<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return GetOne(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetOne<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return GetOne(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetOne<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbReader.GetOne<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public IFindFluent<TDocument, TDocument> GetCursor<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbReader.GetCursor<TDocument, TKey>(filter, partitionKey);\n        }\n\n        /// <inheritdoc />\n        public async Task<bool> AnyAsync<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n        {\n            return await AnyAsync(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<bool> AnyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await AnyAsync(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<bool> AnyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await AnyAsync(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<bool> AnyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbReader.AnyAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public bool Any<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n        {\n            return Any(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public bool Any<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return Any(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public bool Any<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return Any(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public bool Any<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbReader.Any<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<List<TDocument>> GetAllAsync<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetAllAsync(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<List<TDocument>> GetAllAsync<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetAllAsync(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<List<TDocument>> GetAllAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetAllAsync(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<List<TDocument>> GetAllAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbReader.GetAllAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public List<TDocument> GetAll<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n        {\n            return GetAll(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public List<TDocument> GetAll<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return GetAll(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public List<TDocument> GetAll<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return GetAll(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public List<TDocument> GetAll<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbReader.GetAll<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<long> CountAsync<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n        {\n            return await CountAsync(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<long> CountAsync<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await CountAsync(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<long> CountAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await CountAsync(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<long> CountAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbReader.CountAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public long Count<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n        {\n            return Count(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public long Count<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return Count(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public long Count<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return Count(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public long Count<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbReader.Count<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetByMaxAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetByMaxAsync(filter, maxValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetByMaxAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetByMaxAsync(filter, maxValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetByMaxAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetByMaxAsync(filter, maxValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetByMaxAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbReader.GetByMaxAsync<TDocument, TKey>(filter, maxValueSelector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetByMax<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector)\n            where TDocument : IDocument<TKey>\n        {\n            return GetByMax(filter, maxValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetByMax<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return GetByMax(filter, maxValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetByMax<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return GetByMax(filter, maxValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetByMax<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbReader.GetByMax<TDocument, TKey>(filter, maxValueSelector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetByMinAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetByMinAsync(filter, minValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetByMinAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetByMinAsync(filter, minValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetByMinAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetByMinAsync(filter, minValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<TDocument> GetByMinAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbReader.GetByMinAsync<TDocument, TKey>(filter, minValueSelector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetByMin<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector)\n            where TDocument : IDocument<TKey>\n        {\n            return GetByMin(filter, minValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetByMin<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return GetByMin(filter, minValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetByMin<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return GetByMin(filter, minValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetByMin<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbReader.GetByMin<TDocument, TKey>(filter, minValueSelector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<TValue> GetMaxValueAsync<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetMaxValueAsync(filter, maxValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<TValue> GetMaxValueAsync<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetMaxValueAsync(filter, maxValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public async Task<TValue> GetMaxValueAsync<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetMaxValueAsync(filter, maxValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public async Task<TValue> GetMaxValueAsync<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbReader.GetMaxValueAsync<TDocument, TKey, TValue>(filter, maxValueSelector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public TValue GetMaxValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector)\n            where TDocument : IDocument<TKey>\n        {\n            return GetMaxValue(filter, maxValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public TValue GetMaxValue<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return GetMaxValue(filter, maxValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public TValue GetMaxValue<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return GetMaxValue(filter, maxValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public TValue GetMaxValue<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbReader.GetMaxValue<TDocument, TKey, TValue>(filter, maxValueSelector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TValue> GetMinValueAsync<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetMinValueAsync(filter, minValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TValue> GetMinValueAsync<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetMinValueAsync(filter, minValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TValue> GetMinValueAsync<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await GetMinValueAsync(filter, minValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TValue> GetMinValueAsync<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbReader.GetMinValueAsync<TDocument, TKey, TValue>(filter, minValueSelector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TValue GetMinValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector)\n            where TDocument : IDocument<TKey>\n        {\n            return GetMinValue(filter, minValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TValue GetMinValue<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return GetMinValue(filter, minValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TValue GetMinValue<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return GetMinValue(filter, minValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TValue GetMinValue<TDocument, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbReader.GetMinValue<TDocument, TKey, TValue>(filter, minValueSelector, partitionKey, cancellationToken);\n        }\n\n        #endregion\n\n        #region Maths\n\n        /// <inheritdoc />\n        public virtual async Task<int> SumByAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector)\n            where TDocument : IDocument<TKey>\n        {\n            return await SumByAsync(filter, selector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<int> SumByAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await SumByAsync(filter, selector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<int> SumByAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await SumByAsync(filter, selector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<int> SumByAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbReader.SumByAsync<TDocument, TKey>(filter, selector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<decimal> SumByAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, decimal>> selector)\n            where TDocument : IDocument<TKey>\n        {\n            return await SumByAsync(filter, selector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<decimal> SumByAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await SumByAsync(filter, selector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<decimal> SumByAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await SumByAsync(filter, selector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<decimal> SumByAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbReader.SumByAsync<TDocument, TKey>(filter, selector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual int SumBy<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector, string partitionKey = null)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbReader.SumBy<TDocument, TKey>(filter, selector, partitionKey);\n        }\n\n        /// <inheritdoc />\n        public virtual decimal SumBy<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            string partitionKey = null)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbReader.SumBy<TDocument, TKey>(filter, selector, partitionKey);\n        }\n\n        #endregion Maths\n\n        #region Project\n\n        /// <inheritdoc />\n        public virtual async Task<TProjection> ProjectOneAsync<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return await ProjectOneAsync(filter, projection, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TProjection> ProjectOneAsync<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return await ProjectOneAsync(filter, projection, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TProjection> ProjectOneAsync<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return await ProjectOneAsync(filter, projection, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TProjection> ProjectOneAsync<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return await MongoDbReader.ProjectOneAsync<TDocument, TProjection, TKey>(filter, projection, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TProjection ProjectOne<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return ProjectOne(filter, projection, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TProjection ProjectOne<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return ProjectOne(filter, projection, null, cancellationToken);\n        }\n\n\n        /// <inheritdoc />\n        public virtual TProjection ProjectOne<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return ProjectOne(filter, projection, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TProjection ProjectOne<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return MongoDbReader.ProjectOne<TDocument, TProjection, TKey>(filter, projection, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return await ProjectManyAsync(filter, projection, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return await ProjectManyAsync(filter, projection, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return await ProjectManyAsync(filter, projection, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return await MongoDbReader.ProjectManyAsync<TDocument, TProjection, TKey>(filter, projection, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> ProjectMany<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return ProjectMany(filter, projection, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> ProjectMany<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return ProjectMany(filter, projection, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> ProjectMany<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return ProjectMany(filter, projection, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> ProjectMany<TDocument, TProjection>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TProjection : class\n        {\n            return MongoDbReader.ProjectMany<TDocument, TProjection, TKey>(filter, projection, partitionKey, cancellationToken);\n        }\n\n        #endregion Project\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/KeyTypedRepository/BaseMongoRepository.TKey.Update.cs",
    "content": "﻿using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.DataAccess.Update;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    public abstract partial class BaseMongoRepository<TKey> : IBaseMongoRepository_Update<TKey>\n        where TKey : IEquatable<TKey>\n    {\n        private IMongoDbUpdater _mongoDbUpdater;\n\n        /// <summary>\n        ///     The MongoDb accessor to update data.\n        /// </summary>\n        protected virtual IMongoDbUpdater MongoDbUpdater\n        {\n            get\n            {\n                if (_mongoDbUpdater != null)\n                {\n                    return _mongoDbUpdater;\n                }\n\n                lock (_initLock)\n                {\n                    if (_mongoDbUpdater == null)\n                    {\n                        _mongoDbUpdater = new MongoDbUpdater(MongoDbContext);\n                    }\n                }\n\n                return _mongoDbUpdater;\n            }\n            set => _mongoDbUpdater = value;\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument>(TDocument modifiedDocument)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateOneAsync(modifiedDocument, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument>(TDocument modifiedDocument, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey>(modifiedDocument, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument>(TDocument modifiedDocument)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateOne(modifiedDocument, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument>(TDocument modifiedDocument, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, TKey>(modifiedDocument, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument>(TDocument documentToModify, UpdateDefinition<TDocument> update)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateOneAsync(documentToModify, update, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument>(\n            TDocument documentToModify,\n            UpdateDefinition<TDocument> update,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey>(documentToModify, update, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument>(TDocument documentToModify, UpdateDefinition<TDocument> update)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateOne(documentToModify, update, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, TKey>(documentToModify, update, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateOne(documentToModify, field, value, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(documentToModify, field, value, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateOneAsync(documentToModify, field, value, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(documentToModify, field, value, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateOne(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateOne(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateOne(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateOne(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateOne(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateOne(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool UpdateOne<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateOneAsync(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateOneAsync(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateOneAsync(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateOneAsync(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateOneAsync(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateOneAsync(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateManyAsync(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateManyAsync(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateManyAsync(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateManyAsync(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateManyAsync(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateManyAsync(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateManyAsync(filter, updateDefinition, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateManyAsync(filter, updateDefinition, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateManyAsync(filter, updateDefinition, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateManyAsync(filter, updateDefinition, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateManyAsync(filter, updateDefinition, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return await UpdateManyAsync(filter, updateDefinition, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> UpdateManyAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateMany(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateMany(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateMany(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateMany(filter, updateDefinition, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateMany(filter, updateDefinition, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateMany(filter, updateDefinition, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbUpdater.UpdateMany<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateMany(filter, updateDefinition, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateMany(filter, updateDefinition, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)\n            where TDocument : IDocument<TKey>\n        {\n            return UpdateMany(filter, updateDefinition, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long UpdateMany<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n        {\n            return MongoDbUpdater.UpdateMany<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/KeyTypedRepository/IBaseMongoRepository.TKey.Create.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The interface exposing data insertion functionality for Key typed repositories.\n    /// </summary>\n    /// <typeparam name=\"TKey\"></typeparam>\n    public interface IBaseMongoRepository_Create<TKey>\n        where TKey : IEquatable<TKey>\n    {\n        /// <summary>\n        ///     Asynchronously adds a document to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"document\">The document you want to add.</param>\n        Task AddOneAsync<TDocument>(TDocument document)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously adds a document to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"document\">The document you want to add.</param>\n        /// <param name=\"cancellationToken\">The cancellation Token.</param>\n        Task AddOneAsync<TDocument>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Adds a document to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"document\">The document you want to add.</param>\n        void AddOne<TDocument>(TDocument document)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Adds a document to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"document\">The document you want to add.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        void AddOne<TDocument>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously adds a list of documents to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"documents\">The documents you want to add.</param>\n        Task AddManyAsync<TDocument>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously adds a list of documents to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"documents\">The documents you want to add.</param>\n        /// <param name=\"cancellationToken\">An optional cancellation Token.</param>\n        Task AddManyAsync<TDocument>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Adds a list of documents to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"documents\">The documents you want to add.</param>\n        void AddMany<TDocument>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>;\n\n\n        /// <summary>\n        ///     Adds a list of documents to the collection.\n        ///     Populates the Id and AddedAtUtc fields if necessary.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"documents\">The documents you want to add.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        void AddMany<TDocument>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/KeyTypedRepository/IBaseMongoRepository.TKey.Delete.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The interface exposing deletion functionality for Key typed repositories.\n    /// </summary>\n    /// <typeparam name=\"TKey\">The type of the document Id.</typeparam>\n    public interface IBaseMongoRepository_Delete<TKey>\n        where TKey : IEquatable<TKey>\n    {\n        /// <summary>\n        ///     Deletes a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"document\">The document you want to delete.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteOne<TDocument>(TDocument document)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Deletes a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"document\">The document you want to delete.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteOne<TDocument>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteOne<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteOne<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteOne<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteOne<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"document\">The document you want to delete.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteOneAsync<TDocument>(TDocument document)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"document\">The document you want to delete.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteOneAsync<TDocument>(TDocument document, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n\n        /// <summary>\n        ///     Asynchronously deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes a document matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes a list of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"documents\">The list of documents to delete.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteManyAsync<TDocument>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously deletes a list of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"documents\">The list of documents to delete.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        Task<long> DeleteManyAsync<TDocument>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Deletes a list of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"documents\">The list of documents to delete.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteMany<TDocument>(IEnumerable<TDocument> documents)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Deletes a list of documents.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"documents\">The list of documents to delete.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteMany<TDocument>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Deletes the documents matching the condition of the LINQ expression filter.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">A LINQ expression filter.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\"></param>\n        /// <returns>The number of documents deleted.</returns>\n        long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/KeyTypedRepository/IBaseMongoRepository.TKey.Index.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The interface exposing index management functionality for Key typed repositories.\n    /// </summary>\n    /// <typeparam name=\"TKey\"></typeparam>\n    public interface IBaseMongoRepository_Index<TKey>\n        where TKey : IEquatable<TKey>\n    {\n        /// <summary>\n        ///     Returns the names of the indexes present on a collection.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <returns>A list containing the names of the indexes on on the concerned collection.</returns>\n        Task<List<string>> GetIndexesNamesAsync<TDocument>()\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns the names of the indexes present on a collection.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>A list containing the names of the indexes on on the concerned collection.</returns>\n        Task<List<string>> GetIndexesNamesAsync<TDocument>(CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns the names of the indexes present on a collection.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"partitionKey\">An optional partition key</param>\n        /// <returns>A list containing the names of the indexes on on the concerned collection.</returns>\n        Task<List<string>> GetIndexesNamesAsync<TDocument>(string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Returns the names of the indexes present on a collection.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"partitionKey\">An optional partition key</param>\n        /// <param name=\"cancellationToken\">The cancellation token</param>\n        /// <returns>A list containing the names of the indexes on on the concerned collection.</returns>\n        Task<List<string>> GetIndexesNamesAsync<TDocument>(string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Create a text index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateTextIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in ascending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateAscendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates an index on the given field in descending order.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateDescendingIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a hashed index on the given field.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"field\">The field we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateHashedIndexAsync<TDocument>(\n            Expression<Func<TDocument, object>> field,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Creates a combined text index.\n        ///     IndexCreationOptions can be supplied to further specify\n        ///     how the creation should be done.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"fields\">The fields we want to index.</param>\n        /// <param name=\"indexCreationOptions\">Options for creating an index.</param>\n        /// <param name=\"partitionKey\">An optional partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        /// <returns>The result of the create index operation.</returns>\n        Task<string> CreateCombinedTextIndexAsync<TDocument>(\n            IEnumerable<Expression<Func<TDocument, object>>> fields,\n            IndexCreationOptions indexCreationOptions,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Drops the index given a field name\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"indexName\">The name of the index</param>\n        Task DropIndexAsync<TDocument>(string indexName)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Drops the index given a field name\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"indexName\">The name of the index</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task DropIndexAsync<TDocument>(string indexName, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Drops the index given a field name\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"indexName\">The name of the index</param>\n        /// <param name=\"partitionKey\">An optional partition key</param>\n        Task DropIndexAsync<TDocument>(string indexName, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Drops the index given a field name\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"indexName\">The name of the index</param>\n        /// <param name=\"partitionKey\">An optional partition key</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task DropIndexAsync<TDocument>(string indexName, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/KeyTypedRepository/IBaseMongoRepository.TKey.Update.cs",
    "content": "using System;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The base Mongo Repository Update interface. used to update documents in the collections.\n    /// </summary>\n    /// <typeparam name=\"TKey\"></typeparam>\n    public interface IBaseMongoRepository_Update<TKey>\n        where TKey : IEquatable<TKey>\n    {\n        /// <summary>\n        ///     Asynchronously Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        Task<bool> UpdateOneAsync<TDocument>(TDocument modifiedDocument)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Asynchronously Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument>(TDocument modifiedDocument, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        bool UpdateOne<TDocument>(TDocument modifiedDocument)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Updates a document.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool UpdateOne<TDocument>(TDocument modifiedDocument, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Takes a document you want to modify and applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"update\">The update definition for the document.</param>\n        Task<bool> UpdateOneAsync<TDocument>(TDocument documentToModify, UpdateDefinition<TDocument> update)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Takes a document you want to modify and applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"update\">The update definition for the document.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Takes a document you want to modify and applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"update\">The update definition for the document.</param>\n        bool UpdateOne<TDocument>(TDocument documentToModify, UpdateDefinition<TDocument> update)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Takes a document you want to modify and applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"update\">The update definition for the document.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool UpdateOne<TDocument>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        bool UpdateOne<TDocument, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool UpdateOne<TDocument, TField>(\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        Task<bool> UpdateOneAsync<TDocument, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"documentToModify\">The document you want to modify.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TField>(\n            TDocument documentToModify,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        bool UpdateOne<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool UpdateOne<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        bool UpdateOne<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool UpdateOne<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entity selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        bool UpdateOne<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entity selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool UpdateOne<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entity selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        bool UpdateOne<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entity selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        bool UpdateOne<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        Task<bool> UpdateOneAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        Task<bool> UpdateOneAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     Updates the property field with the given value update a property field in entities.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entity selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        Task<bool> UpdateOneAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entity selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entity selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        Task<bool> UpdateOneAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entity selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<bool> UpdateOneAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        Task<long> UpdateManyAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        Task<long> UpdateManyAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        Task<long> UpdateManyAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        Task<long> UpdateManyAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        Task<long> UpdateManyAsync<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        Task<long> UpdateManyAsync<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        Task<long> UpdateManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        Task<long> UpdateManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        Task<long> UpdateManyAsync<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        long UpdateMany<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        long UpdateMany<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The partition key for the document.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument, TField>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        long UpdateMany<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        long UpdateMany<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, updates the property field with the given value.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <typeparam name=\"TField\">The type of the field.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"field\">The field selector.</param>\n        /// <param name=\"value\">The new value of the property field.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument, TField>(\n            FilterDefinition<TDocument> filter,\n            Expression<Func<TDocument, TField>> field,\n            TField value,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        long UpdateMany<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        long UpdateMany<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument>(\n            FilterDefinition<TDocument> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        long UpdateMany<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        long UpdateMany<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)\n            where TDocument : IDocument<TKey>;\n\n        /// <summary>\n        ///     For the entities selected by the filter, applies the update you have defined in MongoDb.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"filter\">The document filter.</param>\n        /// <param name=\"updateDefinition\">The update definition to apply.</param>\n        /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <param name=\"cancellationToken\">The cancellation token.</param>\n        long UpdateMany<TDocument>(\n            Expression<Func<TDocument, bool>> filter,\n            UpdateDefinition<TDocument> updateDefinition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>;\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/KeyTypedRepository/IBaseMongoRepository.TKey.cs",
    "content": "using System;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    /// The interface exposing all the CRUD and Index functionalities for Key typed repositories.\n    /// </summary>\n    /// <typeparam name=\"TKey\">The type of the document Id.</typeparam>\n    public interface IBaseMongoRepository<TKey> :\n        IReadOnlyMongoRepository<TKey>,\n        IBaseMongoRepository_Create<TKey>,\n        IBaseMongoRepository_Delete<TKey>,\n        IBaseMongoRepository_Index<TKey>,\n        IBaseMongoRepository_Update<TKey>\n        where TKey : IEquatable<TKey>\n    {\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/Models/Document.cs",
    "content": "﻿using MongoDB.Bson.Serialization.Attributes;\nusing System;\n\nnamespace MongoDbGenericRepository.Models\n{\n    /// <summary>\n    /// This class represents a basic document that can be stored in MongoDb.\n    /// Your document must implement this class in order for the MongoDbRepository to handle them.\n    /// </summary>\n    public class Document : IDocument\n    {\n        /// <summary>\n        /// The document constructor\n        /// </summary>\n        public Document()\n        {\n            Id = Guid.NewGuid();\n            AddedAtUtc = DateTime.UtcNow;\n        }\n\n        /// <summary>\n        /// The Id of the document\n        /// </summary>\n        [BsonId]\n        public Guid Id { get; set; }\n\n        /// <summary>\n        /// The datetime in UTC at which the document was added.\n        /// </summary>\n        public DateTime AddedAtUtc { get; set; }\n\n        /// <summary>\n        /// The version of the schema of the document\n        /// </summary>\n        public int Version { get; set; }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/Models/IDocument.cs",
    "content": "﻿using System;\n\nnamespace MongoDbGenericRepository.Models\n{\n    /// <summary>\n    /// This class represents a basic document that can be stored in MongoDb.\n    /// Your document must implement this class in order for the MongoDbRepository to handle them.\n    /// </summary>\n    public interface IDocument<TKey> where TKey : IEquatable<TKey>\n    {\n        /// <summary>\n        /// The Primary Key, which must be decorated with the [BsonId] attribute \n        /// if you want the MongoDb C# driver to consider it to be the document ID.\n        /// </summary>\n        TKey Id { get; set; }\n        /// <summary>\n        /// A version number, to indicate the version of the schema.\n        /// </summary>\n        int Version { get; set; }\n    }\n\n    /// <summary>\n    /// This class represents a basic document that can be stored in MongoDb.\n    /// Your document must implement this class in order for the MongoDbRepository to handle them.\n    /// </summary>\n    public interface IDocument : IDocument<Guid>\n    {\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/Models/IPartitionedDocument.cs",
    "content": "﻿namespace MongoDbGenericRepository.Models\n{\n    /// <summary>\n    /// This class represents a document that can be inserted in a collection that can be partitioned.\n    /// The partition key allows for the creation of different collections having the same document schema.\n    /// This can be useful if you are planning to build a Software as a Service (SaaS) Platform, or if you want to reduce indexing.\n    /// You could for example insert Logs in different collections based on the week and year they where created, or their Log category/source.\n    /// </summary>\n    public interface IPartitionedDocument\n    {\n        /// <summary>\n        /// The partition key used to partition your collection.\n        /// </summary>\n        string PartitionKey { get; set; }\n    }\n}\n"
  },
  {
    "path": "MongoDbGenericRepository/Models/IndexCreationOptions.cs",
    "content": "﻿using System;\n\nnamespace MongoDbGenericRepository.Models\n{\n    /// <summary>\n    /// Options for creating an index.\n    /// </summary>\n    public class IndexCreationOptions\n    {\n        /// <summary>\n        /// Gets or sets a value indicating whether the index is a unique index.\n        /// </summary> \n        public bool? Unique { get; set; }\n        /// <summary>\n        /// Gets or sets the index version for text indexes.\n        /// </summary>  \n        public int? TextIndexVersion { get; set; }\n        /// <summary>\n        /// Gets or sets the index version for 2dsphere indexes.\n        /// </summary>\n        public int? SphereIndexVersion { get; set; }\n        /// <summary>\n        /// Gets or sets a value indicating whether the index is a sparse index.\n        /// </summary>   \n        public bool? Sparse { get; set; }\n        /// <summary>\n        /// Gets or sets the index name.\n        /// </summary>  \n        public string Name { get; set; }\n        /// <summary>\n        /// Gets or sets the min value for 2d indexes.\n        /// </summary>   \n        public double? Min { get; set; }\n        /// <summary>\n        /// Gets or sets the max value for 2d indexes.\n        /// </summary>\n        public double? Max { get; set; }\n        /// <summary>\n        /// Gets or sets the language override.\n        /// </summary>   \n        public string LanguageOverride { get; set; }\n        /// <summary>\n        /// Gets or sets when documents expire (used with TTL indexes).\n        /// </summary> \n        public TimeSpan? ExpireAfter { get; set; }\n        /// <summary>\n        /// Gets or sets the default language.\n        /// </summary>  \n        public string DefaultLanguage { get; set; }\n        /// <summary>\n        /// Gets or sets the precision, in bits, used with geohash indexes.\n        /// </summary>   \n        public int? Bits { get; set; }\n        /// <summary>\n        /// Gets or sets a value indicating whether to create the index in the background.\n        /// </summary> \n        public bool? Background { get; set; }\n        /// <summary>\n        /// Gets or sets the version of the index.\n        /// </summary>   \n        public int? Version { get; set; }\n    }\n}\n"
  },
  {
    "path": "MongoDbGenericRepository/Models/PartitionedDocument.cs",
    "content": "﻿namespace MongoDbGenericRepository.Models\n{\n    /// <summary>\n    /// This class represents a document that can be inserted in a collection that can be partitioned.\n    /// The partition key allows for the creation of different collections having the same document schema.\n    /// This can be useful if you are planning to build a Software as a Service (SaaS) Platform, or if you want to reduce indexing.\n    /// You could for example insert Logs in different collections based on the week and year they where created, or their Log category/source.\n    /// </summary>\n    public class PartitionedDocument : Document, IPartitionedDocument\n    {\n        /// <summary>\n        /// The constructor, it needs a partition key.\n        /// </summary>\n        /// <param name=\"partitionKey\"></param>\n        public PartitionedDocument(string partitionKey)\n        {\n            PartitionKey = partitionKey;\n        }\n        /// <summary>\n        /// The name of the property used for partitioning the collection\n        /// This will not be inserted into the collection.\n        /// This partition key will be prepended to the collection name to create a new collection.\n        /// </summary>\n        public string PartitionKey { get; set; }\n    }\n}\n"
  },
  {
    "path": "MongoDbGenericRepository/MongoDbContext.cs",
    "content": "﻿using MongoDB.Driver;\nusing MongoDbGenericRepository.Attributes;\nusing MongoDbGenericRepository.Utils;\nusing System.Linq;\nusing System.Reflection;\nusing MongoDB.Bson;\nusing MongoDB.Bson.Serialization.Serializers;\nusing MongoDbGenericRepository.Internals;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    /// The MongoDb context\n    /// </summary>\n    public class MongoDbContext : IMongoDbContext\n    {\n        /// <summary>\n        /// The IMongoClient from the official MongoDB driver\n        /// </summary>\n        public IMongoClient Client { get; }\n\n        /// <summary>\n        /// The IMongoDatabase from the official MongoDB driver\n        /// </summary>\n        public IMongoDatabase Database { get; }\n\n        /// <summary>\n        /// The constructor of the MongoDbContext, it needs an object implementing <see cref=\"IMongoDatabase\"/>.\n        /// </summary>\n        /// <param name=\"mongoDatabase\">An object implementing IMongoDatabase</param>\n        public MongoDbContext(IMongoDatabase mongoDatabase)\n        {\n            // Avoid legacy UUID representation: use Binary 0x04 subtype.\n            InitializeGuidRepresentation();\n            Database = mongoDatabase;\n            Client = Database.Client;\n        }\n\n        /// <summary>\n        /// The constructor of the MongoDbContext, it needs a connection string and a database name. \n        /// </summary>\n        /// <param name=\"connectionString\">The connections string.</param>\n        /// <param name=\"databaseName\">The name of your database.</param>\n        public MongoDbContext(string connectionString, string databaseName)\n        {\n            InitializeGuidRepresentation();\n            Client = new MongoClient(connectionString);\n            Database = Client.GetDatabase(databaseName);\n        }\n\n        /// <summary>\n        /// Initialise an instance of a <see cref=\"IMongoDbContext\"/> using a connection string\n        /// </summary>\n        /// <param name=\"connectionString\"></param>\n        public MongoDbContext(string connectionString)\n            : this(connectionString, new MongoUrl(connectionString).DatabaseName)\n        {\n        }\n\n        /// <summary>\n        /// The constructor of the MongoDbContext, it needs a connection string and a database name. \n        /// </summary>\n        /// <param name=\"client\">The MongoClient.</param>\n        /// <param name=\"databaseName\">The name of your database.</param>\n        public MongoDbContext(MongoClient client, string databaseName)\n        {\n            InitializeGuidRepresentation();\n            Client = client;\n            Database = client.GetDatabase(databaseName);\n        }\n\n        /// <summary>\n        /// Returns a collection for a document type. Also handles document types with a partition key.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <param name=\"partitionKey\">The optional value of the partition key.</param>\n        public virtual IMongoCollection<TDocument> GetCollection<TDocument>(string partitionKey = null)\n        {\n            return Database.GetCollection<TDocument>(GetCollectionName<TDocument>(partitionKey));\n        }\n\n        /// <summary>\n        /// Drops a collection, use very carefully.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        public virtual void DropCollection<TDocument>(string partitionKey = null)\n        {\n            Database.DropCollection(GetCollectionName<TDocument>(partitionKey));\n        }\n\n        /// <summary>\n        /// Sets the Guid representation of the MongoDB Driver.\n        /// </summary>\n        /// <param name=\"guidRepresentation\">The new value of the GuidRepresentation</param>\n        public virtual void SetGuidRepresentation(GuidRepresentation guidRepresentation)\n        {\n            // GuidRepresentation and GuidRepresentationMode will be removed in the next major release of the MongoDB Driver.\n            // We can safely replace this with RepositorySerializationProvider.Instance.RegisterSerializer once we upgrade to the next major release.\n#pragma warning disable CS0618\n#if NETSTANDARD2_0 || NET472\n            BsonDefaults.GuidRepresentationMode = GuidRepresentationMode.V3;\n#endif\n            RepositorySerializationProvider.Instance.RegisterSerializer(new GuidSerializer(guidRepresentation));\n#pragma warning restore CS0618\n        }\n\n        /// <summary>\n        /// Extracts the CollectionName attribute from the entity type, if any.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <returns>The name of the collection in which the TDocument is stored.</returns>\n        protected virtual string GetAttributeCollectionName<TDocument>()\n        {\n            return (typeof(TDocument).GetTypeInfo()\n                .GetCustomAttributes(typeof(CollectionNameAttribute))\n                .FirstOrDefault() as CollectionNameAttribute)?.Name;\n        }\n\n        /// <summary>\n        /// Initialize the Guid representation of the MongoDB Driver.\n        /// Override this method to change the default GuidRepresentation.\n        /// </summary>\n        protected virtual void InitializeGuidRepresentation()\n        {\n            // by default, avoid legacy UUID representation: use Binary 0x04 subtype.\n            SetGuidRepresentation(GuidRepresentation.Standard);\n        }\n\n        /// <summary>\n        /// Given the document type and the partition key, returns the name of the collection it belongs to.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n\t    /// <param name=\"partitionKey\">The value of the partition key.</param>\n        /// <returns>The name of the collection.</returns>\n        protected virtual string GetCollectionName<TDocument>(string partitionKey)\n        {\n            var collectionName = GetAttributeCollectionName<TDocument>() ?? Pluralize<TDocument>();\n            if (string.IsNullOrEmpty(partitionKey))\n            {\n                return collectionName;\n            }\n            return $\"{partitionKey}-{collectionName}\";\n        }\n\n        /// <summary>\n        /// Very naively pluralizes a TDocument type name.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        /// <returns>The pluralized document name.</returns>\n        protected virtual string Pluralize<TDocument>()\n        {\n            return (typeof(TDocument).Name.Pluralize()).Camelize();\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/MongoDbGenericRepository.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>net472;netstandard2.0;netstandard2.1</TargetFrameworks>\n\t<Nullable>disable</Nullable>\n\t<ImplicitUsings>enable</ImplicitUsings>\n    <LangVersion>12.0</LangVersion>\n\t<GenerateDocumentationFile>true</GenerateDocumentationFile>\n    <PackageId>MongoDbGenericRepository</PackageId>\n    <Authors>Alexandre Spieser</Authors>\n    <Title>MongoDb Generic Repository</Title>\n    <Description>A generic repository implementation using the MongoDB C# 2.x driver.</Description>\n\t<PackageLicenseExpression>MIT</PackageLicenseExpression>\n    <PackageProjectUrl>https://github.com/alexandre-spieser/mongodb-generic-repository</PackageProjectUrl>\n    <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>\n    <PackageReleaseNotes>https://github.com/alexandre-spieser/mongodb-generic-repository/releases</PackageReleaseNotes>\n    <Copyright>Copyright 2024 (c) Alexandre Spieser. All rights reserved.</Copyright>\n    <PackageTags>MongoDb Repository Generic NoSql</PackageTags>\n    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>\n    <Version>2.0.0</Version>\n    <RepositoryUrl>https://github.com/alexandre-spieser/mongodb-generic-repository</RepositoryUrl>\n    <RepositoryType>Git</RepositoryType>\n    <PackageReadmeFile>README.md</PackageReadmeFile>\n\t<DocumentationFile>bin\\$(Configuration)\\$(TargetFramework)\\$(AssemblyName).xml</DocumentationFile>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <None Include=\"..\\README.md\" Pack=\"true\" PackagePath=\"\\\" />\n  </ItemGroup>\n\n  <ItemGroup Condition=\"'$(TargetFramework)' == 'net472' or '$(TargetFramework)' == 'netstandard2.0'\">\n    <PackageReference Include=\"MongoDB.Driver\" Version=\"[2.30.0,3)\" />\n  </ItemGroup>\n\n  <ItemGroup Condition=\"'$(TargetFramework)' == 'netstandard2.1'\">\n    <PackageReference Include=\"MongoDB.Driver\" Version=\"[3.*,)\" />\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "MongoDbGenericRepository/MongoDbGenericRepository.xml",
    "content": "<?xml version=\"1.0\"?>\n<doc>\n    <assembly>\n        <name>MongoDbGenericRepository</name>\n    </assembly>\n    <members>\n        <member name=\"T:MongoDbGenericRepository.IBaseMongoRepository\">\n            <summary>\n            The IBaseMongoRepository interface exposes the CRUD functionality of the BaseMongoRepository.\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository.GetPaginatedAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Int32,System.Int32,System.String)\">\n            <summary>\n            Asynchronously returns a paginated list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\"></param>\n            <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n            <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository.GetPaginatedAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Int32,System.Int32,System.String)\">\n            <summary>\n            Asynchronously returns a paginated list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\"></param>\n            <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n            <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository.GetAndUpdateOne``1(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},MongoDB.Driver.FindOneAndUpdateOptions{``0,``0})\">\n            <summary>\n            GetAndUpdateOne with filter\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\"></param>\n            <param name=\"update\"></param>\n            <param name=\"options\"></param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository.GetAndUpdateOne``2(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},MongoDB.Driver.FindOneAndUpdateOptions{``0,``0})\">\n            <summary>\n            GetAndUpdateOne with filter\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\"></param>\n            <param name=\"update\"></param>\n            <param name=\"options\"></param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateOneAsync``2(``0)\">\n            <summary>\n            Asynchronously Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateOne``2(``0)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateOneAsync``2(``0,MongoDB.Driver.UpdateDefinition{``0})\">\n            <summary>\n            Takes a document you want to modify and applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"update\">The update definition for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateOne``2(``0,MongoDB.Driver.UpdateDefinition{``0})\">\n            <summary>\n            Takes a document you want to modify and applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"update\">The update definition for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateOne``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entity selected by the filter, updates the property field with the given value..\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateOneAsync``3(``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateOneAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entity selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateOne``3(``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateOneAsync``3(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateOne``3(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateManyAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateManyAsync``3(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateManyAsync``2(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateManyAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateMany``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateMany``3(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateMany``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update.UpdateMany``2(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.IBaseMongoRepository_Update_ClientSession.UpdateOne``3(MongoDB.Driver.IClientSessionHandle,System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.IBaseMongoRepository_Update_ClientSession.UpdateOne``3(MongoDB.Driver.IClientSessionHandle,MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.IBaseMongoRepository_Update_ClientSession.UpdateOne``3(MongoDB.Driver.IClientSessionHandle,``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"documentToModify\">The document to modify.</param>\n            <param name=\"update\">The update definition.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.IBaseMongoRepository_Update_ClientSession.UpdateOne``2(MongoDB.Driver.IClientSessionHandle,``0,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"documentToModify\">The document to modify.</param>\n            <param name=\"update\">The update definition.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.IBaseMongoRepository_Update_ClientSession.UpdateOne``2(MongoDB.Driver.IClientSessionHandle,``0,MongoDB.Driver.UpdateDefinition{``0},System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param> \n            <param name=\"documentToModify\">The document to modify.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.IBaseMongoRepository_Update_ClientSession.UpdateOneAsync``3(MongoDB.Driver.IClientSessionHandle,System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"documentToModify\">The document to modify.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.IBaseMongoRepository_Update_ClientSession.UpdateOneAsync``3(MongoDB.Driver.IClientSessionHandle,MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"filter\">The filter for the update.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"partitionKey\">The optional partition key.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.IBaseMongoRepository_Update_ClientSession.UpdateOneAsync``3(MongoDB.Driver.IClientSessionHandle,``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"filter\">The filter for the update.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"partitionKey\">The optional partition key.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.IBaseMongoRepository_Update_ClientSession.UpdateOneAsync``2(MongoDB.Driver.IClientSessionHandle,``0,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"filter\">The filter for the update.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"partitionKey\">The optional partition key.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.IBaseMongoRepository_Update_ClientSession.UpdateOneAsync``2(MongoDB.Driver.IClientSessionHandle,``0,MongoDB.Driver.UpdateDefinition{``0},System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"filter\">The filter for the update.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"partitionKey\">The optional partition key.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOneAsync``2(MongoDB.Driver.IClientSessionHandle,``0,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOne``2(MongoDB.Driver.IClientSessionHandle,``0,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOneAsync``2(MongoDB.Driver.IClientSessionHandle,``0,MongoDB.Driver.UpdateDefinition{``0},System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"documentToModify\">The document to modify.</param>\n            <param name=\"update\">The update definition.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOne``2(MongoDB.Driver.IClientSessionHandle,``0,MongoDB.Driver.UpdateDefinition{``0},System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"documentToModify\">The document to modify.</param>\n            <param name=\"update\">The update definition.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOneAsync``3(MongoDB.Driver.IClientSessionHandle,``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param> \n            <param name=\"documentToModify\">The document to modify.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOne``3(MongoDB.Driver.IClientSessionHandle,``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"documentToModify\">The document to modify.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOneAsync``3(MongoDB.Driver.IClientSessionHandle,MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"filter\">The filter for the update.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"partitionKey\">The optional partition key.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOneAsync``3(MongoDB.Driver.IClientSessionHandle,System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"filter\">The filter for the update.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"partitionKey\">The optional partition key.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOne``3(MongoDB.Driver.IClientSessionHandle,MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"filter\">The filter for the update.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"partitionKey\">The optional partition key.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOne``3(MongoDB.Driver.IClientSessionHandle,System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"filter\">The filter for the update.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"partitionKey\">The optional partition key.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOneAsync``2(``0)\">\n            <summary>\n            Asynchronously Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOne``2(``0)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOneAsync``2(``0,MongoDB.Driver.UpdateDefinition{``0})\">\n            <summary>\n            Takes a document you want to modify and applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"update\">The update definition for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOne``2(``0,MongoDB.Driver.UpdateDefinition{``0})\">\n            <summary>\n            Takes a document you want to modify and applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"update\">The update definition for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOneAsync``3(``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOne``3(``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOneAsync``3(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOneAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entity selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOne``3(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            Updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateOne``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entity selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateManyAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateManyAsync``3(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateManyAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, apply the update definition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateManyAsync``2(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, apply the update definition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateMany``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateMany``3(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Update.MongoDbUpdater.UpdateMany``2(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, apply the update definition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"UpdateDefinition\">The update definition.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Base.DataAccessBase.HandlePartitioned``2(``0)\">\n            <summary>\n            Gets a collections for a potentially partitioned document type.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"document\">The document.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Base.DataAccessBase.GetCollection``2(System.String)\">\n            <summary>\n            Gets a collections for the type TDocument with a partition key.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"partitionKey\">The collection partition key.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Base.DataAccessBase.HandlePartitioned``2(System.String)\">\n            <summary>\n            Gets a collections for a potentially partitioned document type.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"partitionKey\">The collection partition key.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Base.DataAccessBase.ConvertExpression``2(System.Linq.Expressions.Expression{System.Func{``0,``1}})\">\n            <summary>\n            Converts a LINQ expression of TDocument, TValue to a LINQ expression of TDocument, object\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TValue\">The type of the value.</typeparam>\n            <param name=\"expression\">The expression to convert</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Base.DataAccessBase.MapIndexOptions(MongoDbGenericRepository.Models.IndexCreationOptions)\">\n            <summary>\n            Maps a IndexCreationOptions object to a MongoDB.Driver.CreateIndexOptions object\n            </summary>\n            <param name=\"indexCreationOptions\">The options for creating an index.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Base.DataAccessBase.GetMinMongoQuery``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)\">\n            <summary>\n            Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Base.DataAccessBase.GetMaxMongoQuery``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)\">\n            <summary>\n            Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"maxValueSelector\">A property selector to order by descending.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Create.MongoDbCreator.AddOneAsync``2(``0)\">\n            <summary>\n            Asynchronously adds a document to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"document\">The document you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Create.MongoDbCreator.AddOne``2(``0)\">\n            <summary>\n            Adds a document to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"document\">The document you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Create.MongoDbCreator.AddManyAsync``2(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Asynchronously adds a list of documents to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documents\">The documents you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Create.MongoDbCreator.AddMany``2(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Adds a list of documents to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documents\">The documents you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Create.MongoDbCreator.FormatDocument``2(``0)\">\n            <summary>\n            Sets the value of the document Id if it is not set already.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"document\">The document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Delete.MongoDbEraser.DeleteOne``2(``0)\">\n            <summary>\n            Deletes a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"document\">The document you want to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Delete.MongoDbEraser.DeleteOneAsync``2(``0)\">\n            <summary>\n            Asynchronously deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"document\">The document you want to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Delete.MongoDbEraser.DeleteOne``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Delete.MongoDbEraser.DeleteOneAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Delete.MongoDbEraser.DeleteManyAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously deletes the documents matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Delete.MongoDbEraser.DeleteManyAsync``2(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Asynchronously deletes a list of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documents\">The list of documents to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Delete.MongoDbEraser.DeleteMany``2(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Deletes a list of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documents\">The list of documents to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Delete.MongoDbEraser.DeleteMany``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Deletes the documents matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Index.MongoDbIndexHandler.GetIndexesNamesAsync``2(System.String)\">\n            <summary>\n            Returns the names of the indexes present on a collection.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"partitionKey\">An optional partition key</param>\n            <returns>A list containing the names of the indexes on on the concerned collection.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Index.MongoDbIndexHandler.CreateTextIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Create a text index on the given field.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Index.MongoDbIndexHandler.CreateAscendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates an index on the given field in ascending order.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Index.MongoDbIndexHandler.CreateDescendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates an index on the given field in descending order.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Index.MongoDbIndexHandler.CreateHashedIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates a hashed index on the given field.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Index.MongoDbIndexHandler.CreateCombinedTextIndexAsync``2(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates a combined text index.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"fields\">The fields we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Index.MongoDbIndexHandler.DropIndexAsync``2(System.String,System.String)\">\n            <summary>\n            Drops the index given a field name\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"indexName\">The name of the index</param>\n            <param name=\"partitionKey\">An optional partition key</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetByIdAsync``2(``1,System.String)\">\n            <summary>\n            Asynchronously returns one document given its id.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"id\">The Id of the document you want to get.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetById``2(``1,System.String)\">\n            <summary>\n            Returns one document given its id.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"id\">The Id of the document you want to get.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetOneAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously returns one document given an expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetOne``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns one document given an expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetCursor``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns a collection cursor.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.AnyAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns true if any of the document of the collection matches the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.Any``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns true if any of the document of the collection matches the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetAllAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously returns a list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetAll``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns a list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.CountAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously counts how many documents match the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partitionKey</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.Count``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Counts how many documents match the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partitionKey</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetByMaxAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"maxValueSelector\">A property selector to order by descending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetByMax``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"maxValueSelector\">A property selector to order by descending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetByMinAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetByMin``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetMaxValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)\">\n            <summary>\n            Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"orderByAscending\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetMaxValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)\">\n            <summary>\n            Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetMinValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)\">\n            <summary>\n            Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetMinValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)\">\n            <summary>\n            Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.SumByAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Int32}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.SumBy``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Int32}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.SumByAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Decimal}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.SumBy``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Decimal}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GroupBy``4(System.Linq.Expressions.Expression{System.Func{``0,``1}},System.Linq.Expressions.Expression{System.Func{System.Linq.IGrouping{``1,``0},``2}},System.String)\">\n            <summary>\n            Groups a collection of documents given a grouping criteria, \n            and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n            <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n            <param name=\"groupingCriteria\">The grouping criteria.</param>\n            <param name=\"groupProjection\">The projected group result.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GroupBy``4(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.Linq.Expressions.Expression{System.Func{System.Linq.IGrouping{``1,``0},``2}},System.String)\">\n            <summary>\n            Groups filtered a collection of documents given a grouping criteria, \n            and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n            <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The grouping criteria.</param>\n            <param name=\"projection\">The projected group result.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetSortedPaginatedAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.Boolean,System.Int32,System.Int32,System.String)\">\n            <summary>\n            Asynchronously returns a paginated list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"sortSelector\">The property selector.</param>\n            <param name=\"ascending\">Order of the sorting.</param>\n            <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n            <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.GetSortedPaginatedAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.SortDefinition{``0},System.Int32,System.Int32,System.String)\">\n            <summary>\n            Asynchronously returns a paginated list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"sortDefinition\">The sort definition.</param>\n            <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n            <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.ProjectOneAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Asynchronously returns a projected document matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.ProjectOne``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Returns a projected document matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.ProjectManyAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Asynchronously returns a list of projected documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.DataAccess.Read.MongoDbReader.ProjectMany``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Asynchronously returns a list of projected documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.IBaseReadOnlyRepository\">\n            <summary>\n            The IBaseReadOnlyRepository exposes the generic Read Only functionality of the BaseMongoRepository.\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.IBaseReadOnlyRepository.ConnectionString\">\n            <summary>\n            The connection string.\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.IBaseReadOnlyRepository.DatabaseName\">\n            <summary>\n            The database name.\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetByIdAsync``2(``1,System.String)\">\n            <summary>\n            Asynchronously returns one document given its id.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"id\">The Id of the document you want to get.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetById``2(``1,System.String)\">\n            <summary>\n            Returns one document given its id.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"id\">The Id of the document you want to get.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetOneAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously returns one document given an expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetOne``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns one document given an expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetCursor``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns a collection cursor.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.AnyAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns true if any of the document of the collection matches the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.Any``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns true if any of the document of the collection matches the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetAllAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously returns a list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetAll``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns a list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.CountAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously counts how many documents match the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partitionKey</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.Count``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Counts how many documents match the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partitionKey</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetByMaxAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"orderByDescending\">A property selector to order by descending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetByMax``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"orderByDescending\">A property selector to order by descending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetByMinAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"orderByAscending\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetByMin``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"orderByAscending\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetMaxValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)\">\n            <summary>\n            Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"orderByAscending\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetMaxValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)\">\n            <summary>\n            Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"orderByDescending\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetMinValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)\">\n            <summary>\n            Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetMinValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)\">\n            <summary>\n            Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.SumByAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Int32}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.SumBy``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Int32}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.SumByAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Decimal}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.SumBy``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Decimal}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.ProjectOneAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Asynchronously returns a projected document matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\"></param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.ProjectOne``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Returns a projected document matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\"></param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.ProjectManyAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Asynchronously returns a list of projected documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\"></param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.ProjectMany``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Asynchronously returns a list of projected documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\"></param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GroupBy``4(System.Linq.Expressions.Expression{System.Func{``0,``1}},System.Linq.Expressions.Expression{System.Func{System.Linq.IGrouping{``1,``0},``2}},System.String)\">\n            <summary>\n            Groups filtered a collection of documents given a grouping criteria, \n            and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n            <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"groupingCriteria\">The grouping criteria.</param>\n            <param name=\"groupProjection\">The projected group result.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GroupBy``4(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.Linq.Expressions.Expression{System.Func{System.Linq.IGrouping{``1,``0},``2}},System.String)\">\n            <summary>\n            Groups filtered a collection of documents given a grouping criteria, \n            and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n            <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"groupingCriteria\">The grouping criteria.</param>\n            <param name=\"groupProjection\">The projected group result.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetSortedPaginatedAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.Boolean,System.Int32,System.Int32,System.String)\">\n            <summary>\n            Asynchronously returns a paginated list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"sortSelector\">The property selector.</param>\n            <param name=\"ascending\">Order of the sorting.</param>\n            <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n            <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseReadOnlyRepository.GetSortedPaginatedAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.SortDefinition{``0},System.Int32,System.Int32,System.String)\">\n            <summary>\n            Asynchronously returns a paginated list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"sortDefinition\">The sort definition.</param>\n            <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n            <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.IMongoDbContext\">\n            <summary>\n            This is the interface of the IMongoDbContext which is managed by the <see cref=\"T:MongoDbGenericRepository.BaseMongoRepository\"/>.\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.IMongoDbContext.Client\">\n            <summary>\n            The IMongoClient from the official MongoDb driver\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.IMongoDbContext.Database\">\n            <summary>\n            The IMongoDatabase from the official Mongodb driver\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IMongoDbContext.GetCollection``1(System.String)\">\n            <summary>\n            Returns a collection for a document type that has a partition key.\n            </summary>\n            <typeparam name=\"TDocument\"></typeparam>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IMongoDbContext.DropCollection``1(System.String)\">\n            <summary>\n            Drops a collection having a partitionkey, use very carefully.\n            </summary>\n            <typeparam name=\"TDocument\"></typeparam>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IMongoDbContext.SetGuidRepresentation(MongoDB.Bson.GuidRepresentation)\">\n            <summary>\n            Sets the Guid representation of the MongoDb Driver.\n            </summary>\n            <param name=\"guidRepresentation\">The new value of the GuidRepresentation</param>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.IReadOnlyMongoRepository\">\n            <summary>\n            The IReadOnlyMongoRepository exposes the readonly functionality of the BaseMongoRepository.\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetByIdAsync``1(`0,System.String)\">\n            <summary>\n            Asynchronously returns one document given its id.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"id\">The Id of the document you want to get.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetById``1(`0,System.String)\">\n            <summary>\n            Returns one document given its id.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"id\">The Id of the document you want to get.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetOneAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously returns one document given an expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetOne``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns one document given an expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetCursor``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns a collection cursor.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.AnyAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously returns true if any of the document of the collection matches the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.Any``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns true if any of the document of the collection matches the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetAllAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously returns a list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetAll``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns a list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.CountAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously counts how many documents match the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.Count``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Counts how many documents match the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetByMaxAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"orderByDescending\">A property selector to order by descending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetByMax``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"orderByDescending\">A property selector to order by descending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetByMinAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"orderByAscending\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetByMin``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"orderByAscending\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetMaxValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetMaxValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetMinValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetMinValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.SumByAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Int32}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.SumByAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Decimal}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.SumBy``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Int32}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.SumBy``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Decimal}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.ProjectOneAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Asynchronously returns a projected document matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.ProjectOne``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Returns a projected document matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.ProjectManyAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Asynchronously returns a list of projected documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.ProjectMany``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Asynchronously returns a list of projected documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GroupBy``3(System.Linq.Expressions.Expression{System.Func{``0,``1}},System.Linq.Expressions.Expression{System.Func{System.Linq.IGrouping{``1,``0},``2}},System.String)\">\n            <summary>\n            Groups a collection of documents given a grouping criteria, \n            and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n            <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n            <param name=\"groupingCriteria\">The grouping criteria.</param>\n            <param name=\"groupProjection\">The projected group result.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GroupBy``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.Linq.Expressions.Expression{System.Func{System.Linq.IGrouping{``1,``0},``2}},System.String)\">\n            <summary>\n            Groups filtered a collection of documents given a grouping criteria, \n            and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n            <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"groupingCriteria\">The grouping criteria.</param>\n            <param name=\"groupProjection\">The projected group result.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetSortedPaginatedAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.Boolean,System.Int32,System.Int32,System.String)\">\n            <summary>\n            Asynchronously returns a paginated list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"sortSelector\">The property selector.</param>\n            <param name=\"ascending\">Order of the sorting.</param>\n            <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n            <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IReadOnlyMongoRepository`1.GetSortedPaginatedAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.SortDefinition{``0},System.Int32,System.Int32,System.String)\">\n            <summary>\n            Asynchronously returns a paginated list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"sortDefinition\">The sort definition.</param>\n            <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n            <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.Attributes.CollectionNameAttribute\">\n            <summary>\n            This attribute allows you to specify of the name of the collection.\n            Added at commit c117bf2a7fee378f1e02199dea9b2023a7089ee2 by https://github.com/Etchelon\n            who has included the CollectionName attribute into the repo to give another choice to the user on how \n            to name their collections. \n            The attribute takes precedence of course, and if not present the library will fall back to your Pluralize method.\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.Attributes.CollectionNameAttribute.Name\">\n            <summary>\n            The name of the collection in which your documents are stored.\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Attributes.CollectionNameAttribute.#ctor(System.String)\">\n            <summary>\n            The constructor.\n            </summary>\n            <param name=\"name\">The name of the collection.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Create.AddOneAsync``2(``0)\">\n            <summary>\n            Asynchronously adds a document to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"document\">The document you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Create.AddOne``2(``0)\">\n            <summary>\n            Adds a document to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"document\">The document you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Create.AddManyAsync``2(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Asynchronously adds a list of documents to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documents\">The documents you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Create.AddMany``2(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Adds a list of documents to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documents\">The documents you want to add.</param>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.BaseMongoRepository\">\n            <summary>\n            The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n            Its constructor must be given a connection string and a database name.\n            </summary>\n            <summary>\n            The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n            Its constructor must be given a connection string and a database name.\n            </summary>\n            <summary>\n            The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n            Its constructor must be given a connection string and a database name.\n            </summary>\n            <summary>\n            The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n            Its constructor must be given a connection string and a database name.\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.AddOneAsync``2(``0)\">\n            <summary>\n            Asynchronously adds a document to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"document\">The document you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.AddOneAsync``1(``0)\">\n            <summary>\n            Asynchronously adds a document to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"document\">The document you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.AddOne``2(``0)\">\n            <summary>\n            Adds a document to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"document\">The document you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.AddOne``1(``0)\">\n            <summary>\n            Adds a document to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"document\">The document you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.AddManyAsync``2(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Asynchronously adds a list of documents to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documents\">The documents you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.AddManyAsync``1(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Asynchronously adds a list of documents to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documents\">The documents you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.AddMany``2(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Adds a list of documents to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documents\">The documents you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.AddMany``1(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Adds a list of documents to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documents\">The documents you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteOneAsync``1(``0)\">\n            <summary>\n            Asynchronously deletes a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"document\">The document you want to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteOne``1(``0)\">\n            <summary>\n            Deletes a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"document\">The document you want to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteOne``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteOneAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteManyAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously deletes the documents matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteManyAsync``1(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Asynchronously deletes a list of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documents\">The list of documents to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteMany``1(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Deletes a list of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documents\">The list of documents to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteMany``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Deletes the documents matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteOne``2(``0)\">\n            <summary>\n            Deletes a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"document\">The document you want to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteOneAsync``2(``0)\">\n            <summary>\n            Asynchronously deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"document\">The document you want to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteOne``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteOneAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteManyAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously deletes the documents matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteManyAsync``2(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Asynchronously deletes a list of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documents\">The list of documents to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteMany``2(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Deletes a list of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documents\">The list of documents to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DeleteMany``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Deletes the documents matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.GetIndexesNamesAsync``1(System.String)\">\n            <summary>\n            Returns the names of the indexes present on a collection.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"partitionKey\">An optional partition key</param>\n            <returns>A list containing the names of the indexes on on the concerned collection.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.GetIndexesNamesAsync``2(System.String)\">\n            <summary>\n            Returns the names of the indexes present on a collection.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"partitionKey\">An optional partition key</param>\n            <returns>A list containing the names of the indexes on on the concerned collection.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.CreateTextIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Create a text index on the given field.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.CreateTextIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Create a text index on the given field.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.CreateAscendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates an index on the given field in ascending order.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.CreateAscendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates an index on the given field in ascending order.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.CreateDescendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates an index on the given field in descending order.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.CreateDescendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <inheritdoc />\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.CreateHashedIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates a hashed index on the given field.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.CreateHashedIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <inheritdoc />\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.CreateCombinedTextIndexAsync``1(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates a combined text index.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"fields\">The fields we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.CreateCombinedTextIndexAsync``2(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <inheritdoc />\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DropIndexAsync``1(System.String,System.String)\">\n            <summary>\n            Drops the index given a field name\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"indexName\">The name of the index</param>\n            <param name=\"partitionKey\">An optional partition key</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.DropIndexAsync``2(System.String,System.String)\">\n            <inheritdoc />\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.#ctor(System.String,System.String)\">\n            <summary>\n            The constructor taking a connection string and a database name.\n            </summary>\n            <param name=\"connectionString\">The connection string of the MongoDb server.</param>\n            <param name=\"databaseName\">The name of the database against which you want to perform operations.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.#ctor(MongoDbGenericRepository.IMongoDbContext)\">\n            <summary>\n            The constructor taking a <see cref=\"T:MongoDbGenericRepository.IMongoDbContext\"/>.\n            </summary>\n            <param name=\"mongoDbContext\">A mongodb context implementing <see cref=\"T:MongoDbGenericRepository.IMongoDbContext\"/></param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.#ctor(MongoDB.Driver.IMongoDatabase)\">\n            <summary>\n            The constructor taking a <see cref=\"T:MongoDB.Driver.IMongoDatabase\"/>.\n            </summary>\n            <param name=\"mongoDatabase\">A mongodb context implementing <see cref=\"T:MongoDB.Driver.IMongoDatabase\"/></param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.GetPaginatedAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Int32,System.Int32,System.String)\">\n            <summary>\n            Asynchronously returns a paginated list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n            <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.GetPaginatedAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Int32,System.Int32,System.String)\">\n            <summary>\n            Asynchronously returns a paginated list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n            <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.GetAndUpdateOne``1(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},MongoDB.Driver.FindOneAndUpdateOptions{``0,``0})\">\n            <summary>\n            GetAndUpdateOne with filter\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"update\"></param>\n            <param name=\"options\"></param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.GetAndUpdateOne``2(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},MongoDB.Driver.FindOneAndUpdateOptions{``0,``0})\">\n            <summary>\n            GetAndUpdateOne with filter\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"update\"></param>\n            <param name=\"options\"></param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.FormatDocument``2(``0)\">\n            <summary>\n            Sets the value of the document Id if it is not set already.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"document\">The document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.FormatDocument``1(``0)\">\n            <summary>\n            Sets the value of the document Id if it is not set already.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <param name=\"document\">The document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.HandlePartitioned``1(System.String)\">\n            <summary>\n            Gets a collections for a potentially partitioned document type.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <param name=\"partitionKey\">The collection partition key.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.GetCollection``1(System.String)\">\n            <summary>\n            Gets a collections for the type TDocument with a partition key.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <param name=\"partitionKey\">The collection partition key.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``2(MongoDB.Driver.IClientSessionHandle,``0,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``2(MongoDB.Driver.IClientSessionHandle,``0,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``2(MongoDB.Driver.IClientSessionHandle,``0,MongoDB.Driver.UpdateDefinition{``0},System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"documentToModify\">The document to modify.</param>\n            <param name=\"update\">The update definition.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``2(MongoDB.Driver.IClientSessionHandle,``0,MongoDB.Driver.UpdateDefinition{``0},System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"documentToModify\">The document to modify.</param>\n            <param name=\"update\">The update definition.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``3(MongoDB.Driver.IClientSessionHandle,``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param> \n            <param name=\"documentToModify\">The document to modify.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``3(MongoDB.Driver.IClientSessionHandle,``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"documentToModify\">The document to modify.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``3(MongoDB.Driver.IClientSessionHandle,MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"filter\">The filter for the update.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"partitionKey\">The optional partition key.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``3(MongoDB.Driver.IClientSessionHandle,System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"filter\">The filter for the update.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"partitionKey\">The optional partition key.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``3(MongoDB.Driver.IClientSessionHandle,MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"filter\">The filter for the update.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"partitionKey\">The optional partition key.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``3(MongoDB.Driver.IClientSessionHandle,System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String,System.Threading.CancellationToken)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field to update.</typeparam>\n            <param name=\"session\">The client session.</param>\n            <param name=\"filter\">The filter for the update.</param>\n            <param name=\"field\">The field to update.</param>\n            <param name=\"value\">The value of the field.</param>\n            <param name=\"partitionKey\">The optional partition key.</param>\n            <param name=\"cancellationToken\">The optional cancellation token.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``1(``0)\">\n            <summary>\n            Asynchronously Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``1(``0)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``1(``0,MongoDB.Driver.UpdateDefinition{``0})\">\n            <summary>\n            Takes a document you want to modify and applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"update\">The update definition for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``1(``0,MongoDB.Driver.UpdateDefinition{``0})\">\n            <summary>\n            Takes a document you want to modify and applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"update\">The update definition for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``2(``0,System.Linq.Expressions.Expression{System.Func{``0,``1}},``1)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``2(``0,System.Linq.Expressions.Expression{System.Func{``0,``1}},``1)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``2(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entity selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``2(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entity selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateManyAsync``2(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateManyAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateManyAsync``1(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateManyAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateMany``2(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateMany``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateMany``1(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateMany``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``2(``0)\">\n            <summary>\n            Asynchronously Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``2(``0)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``2(``0,MongoDB.Driver.UpdateDefinition{``0})\">\n            <summary>\n            Takes a document you want to modify and applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"update\">The update definition for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``2(``0,MongoDB.Driver.UpdateDefinition{``0})\">\n            <summary>\n            Takes a document you want to modify and applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"update\">The update definition for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``3(``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``3(``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``3(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            Updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entity selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``3(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entity selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateManyAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateManyAsync``3(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateManyAsync``2(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateManyAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateMany``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateMany``3(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateMany``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository.UpdateMany``2(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete.DeleteOne``2(``0)\">\n            <summary>\n            Deletes a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"document\">The document you want to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete.DeleteOneAsync``2(``0)\">\n            <summary>\n            Asynchronously deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"document\">The document you want to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete.DeleteOne``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete.DeleteOneAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete.DeleteManyAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously deletes the documents matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete.DeleteManyAsync``2(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Asynchronously deletes a list of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documents\">The list of documents to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete.DeleteMany``2(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Deletes a list of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"documents\">The list of documents to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete.DeleteMany``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Deletes the documents matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Index.GetIndexesNamesAsync``2(System.String)\">\n            <summary>\n            Returns the names of the indexes present on a collection.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"partitionKey\">An optional partition key</param>\n            <returns>A list containing the names of the indexes on on the concerned collection.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Index.CreateTextIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Create a text index on the given field.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Index.CreateAscendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates an index on the given field in ascending order.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Index.CreateDescendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates an index on the given field in descending order.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Index.CreateHashedIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates a hashed index on the given field.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Index.CreateCombinedTextIndexAsync``2(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates a combined text index.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"fields\">The fields we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Index.DropIndexAsync``2(System.String,System.String)\">\n            <summary>\n            Drops the index given a field name\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"indexName\">The name of the index</param>\n            <param name=\"partitionKey\">An optional partition key</param>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.IBaseMongoRepository_Create`1\">\n            <summary>\n            The interface exposing data insertion functionality for Key typed repositories.\n            </summary>\n            <typeparam name=\"TKey\"></typeparam>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Create`1.AddOneAsync``1(``0)\">\n            <summary>\n            Asynchronously adds a document to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"document\">The document you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Create`1.AddOne``1(``0)\">\n            <summary>\n            Adds a document to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"document\">The document you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Create`1.AddManyAsync``1(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Asynchronously adds a list of documents to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documents\">The documents you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Create`1.AddMany``1(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Adds a list of documents to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documents\">The documents you want to add.</param>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.BaseMongoRepository`1\">\n            <summary>\n            The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n            Its constructor must be given a connection string and a database name.\n            </summary>\n            <summary>\n            The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n            Its constructor must be given a connection string and a database name.\n            </summary>\n            <summary>\n            The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n            Its constructor must be given a connection string and a database name.\n            </summary>\n            <typeparam name=\"TKey\">The type of the document Id.</typeparam>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.BaseMongoRepository`1.MongoDbCreator\">\n            <summary>\n            The MongoDb accessor to insert data.\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.AddOneAsync``1(``0)\">\n            <summary>\n            Asynchronously adds a document to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"document\">The document you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.AddOne``1(``0)\">\n            <summary>\n            Adds a document to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"document\">The document you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.AddManyAsync``1(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Asynchronously adds a list of documents to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documents\">The documents you want to add.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.AddMany``1(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Adds a list of documents to the collection.\n            Populates the Id and AddedAtUtc fields if necessary.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documents\">The documents you want to add.</param>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.BaseMongoRepository`1.MongoDbEraser\">\n            <summary>\n            The MongoDb accessor to delete data.\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.DeleteOne``1(``0)\">\n            <summary>\n            Deletes a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"document\">The document you want to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.DeleteOneAsync``1(``0)\">\n            <summary>\n            Asynchronously deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"document\">The document you want to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.DeleteOne``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.DeleteOneAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.DeleteManyAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously deletes the documents matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.DeleteManyAsync``1(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Asynchronously deletes a list of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documents\">The list of documents to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.DeleteMany``1(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Deletes a list of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documents\">The list of documents to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.DeleteMany``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Deletes the documents matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.BaseMongoRepository`1.MongoDbIndexHandler\">\n            <summary>\n            The MongoDb accessor to manage indexes.\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.GetIndexesNamesAsync``1(System.String)\">\n            <summary>\n            Returns the names of the indexes present on a collection.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"partitionKey\">An optional partition key</param>\n            <returns>A list containing the names of the indexes on on the concerned collection.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.CreateTextIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Create a text index on the given field.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.CreateAscendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates an index on the given field in ascending order.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.CreateDescendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates an index on the given field in descending order.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.CreateHashedIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates a hashed index on the given field.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.CreateCombinedTextIndexAsync``1(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates a combined text index.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"fields\">The fields we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.DropIndexAsync``1(System.String,System.String)\">\n            <summary>\n            Drops the index given a field name\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"indexName\">The name of the index</param>\n            <param name=\"partitionKey\">An optional partition key</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.#ctor(System.String,System.String)\">\n            <summary>\n            The constructor taking a connection string and a database name.\n            </summary>\n            <param name=\"connectionString\">The connection string of the MongoDb server.</param>\n            <param name=\"databaseName\">The name of the database against which you want to perform operations.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.#ctor(MongoDbGenericRepository.IMongoDbContext)\">\n            <summary>\n            The constructor taking a <see cref=\"T:MongoDbGenericRepository.IMongoDbContext\"/>.\n            </summary>\n            <param name=\"mongoDbContext\">A mongodb context implementing <see cref=\"T:MongoDbGenericRepository.IMongoDbContext\"/></param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.#ctor(MongoDB.Driver.IMongoDatabase)\">\n            <summary>\n            The constructor taking a <see cref=\"T:MongoDB.Driver.IMongoDatabase\"/>.\n            </summary>\n            <param name=\"mongoDatabase\">A mongodb context implementing <see cref=\"T:MongoDB.Driver.IMongoDatabase\"/></param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.HandlePartitioned``1(System.String)\">\n            <summary>\n            Gets a collections for a potentially partitioned document type.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <param name=\"partitionKey\">The collection partition key.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.GetCollection``1(System.String)\">\n            <summary>\n            Gets a collections for the type TDocument with a partition key.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <param name=\"partitionKey\">The collection partition key.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateOneAsync``1(``0)\">\n            <summary>\n            Asynchronously Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateOne``1(``0)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateOneAsync``1(``0,MongoDB.Driver.UpdateDefinition{``0})\">\n            <summary>\n            Takes a document you want to modify and applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"update\">The update definition for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateOne``1(``0,MongoDB.Driver.UpdateDefinition{``0})\">\n            <summary>\n            Takes a document you want to modify and applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"update\">The update definition for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateOne``2(``0,System.Linq.Expressions.Expression{System.Func{``0,``1}},``1)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateOneAsync``2(``0,System.Linq.Expressions.Expression{System.Func{``0,``1}},``1)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateOne``2(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateOne``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entity selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateOneAsync``2(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateOneAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entity selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateManyAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateManyAsync``2(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateManyAsync``1(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateManyAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateMany``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateMany``2(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateMany``1(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.BaseMongoRepository`1.UpdateMany``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.IBaseMongoRepository_Delete`1\">\n            <summary>\n            The interface exposing deletion functionality for Key typed repositories.\n            </summary>\n            <typeparam name=\"TKey\">The type of the document Id.</typeparam>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete`1.DeleteOne``1(``0)\">\n            <summary>\n            Deletes a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"document\">The document you want to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete`1.DeleteOneAsync``1(``0)\">\n            <summary>\n            Asynchronously deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"document\">The document you want to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete`1.DeleteOne``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete`1.DeleteOneAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously deletes a document matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete`1.DeleteManyAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously deletes the documents matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete`1.DeleteManyAsync``1(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Asynchronously deletes a list of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documents\">The list of documents to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete`1.DeleteMany``1(System.Collections.Generic.IEnumerable{``0})\">\n            <summary>\n            Deletes a list of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documents\">The list of documents to delete.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Delete`1.DeleteMany``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Deletes the documents matching the condition of the LINQ expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The number of documents deleted.</returns>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.IBaseMongoRepository_Index`1\">\n            <summary>\n            The interface exposing index management functionality for Key typed repositories.\n            </summary>\n            <typeparam name=\"TKey\"></typeparam>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Index`1.GetIndexesNamesAsync``1(System.String)\">\n            <summary>\n            Returns the names of the indexes present on a collection.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"partitionKey\">An optional partition key</param>\n            <returns>A list containing the names of the indexes on on the concerned collection.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Index`1.CreateTextIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Create a text index on the given field.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Index`1.CreateAscendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates an index on the given field in ascending order.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Index`1.CreateDescendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates an index on the given field in descending order.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Index`1.CreateHashedIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates a hashed index on the given field.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"field\">The field we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Index`1.CreateCombinedTextIndexAsync``1(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)\">\n            <summary>\n            Creates a combined text index.\n            IndexCreationOptions can be supplied to further specify \n            how the creation should be done.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"fields\">The fields we want to index.</param>\n            <param name=\"indexCreationOptions\">Options for creating an index.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n            <returns>The result of the create index operation.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Index`1.DropIndexAsync``1(System.String,System.String)\">\n            <summary>\n            Drops the index given a field name\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"indexName\">The name of the index</param>\n            <param name=\"partitionKey\">An optional partition key</param>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.IBaseMongoRepository`1\">\n            <summary>\n            The interface exposing all the CRUD and Index functionalities for Key typed repositories.\n            </summary>\n            <typeparam name=\"TKey\">The type of the document Id.</typeparam>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.ReadOnlyMongoRepository`1\">\n            <summary>\n            The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n            Its constructor must be given a connection string and a database name.\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.ReadOnlyMongoRepository`1.ConnectionString\">\n            <summary>\n            The connection string.\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.ReadOnlyMongoRepository`1.DatabaseName\">\n            <summary>\n            The database name.\n            </summary>\n        </member>\n        <member name=\"F:MongoDbGenericRepository.ReadOnlyMongoRepository`1.MongoDbContext\">\n            <summary>\n            The MongoDbContext\n            </summary>\n        </member>\n        <member name=\"F:MongoDbGenericRepository.ReadOnlyMongoRepository`1.MongoDbReader\">\n            <summary>\n            A MongoDb Reader for read operations\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.#ctor(System.String,System.String)\">\n            <summary>\n            The constructor taking a connection string and a database name.\n            </summary>\n            <param name=\"connectionString\">The connection string of the MongoDb server.</param>\n            <param name=\"databaseName\">The name of the database against which you want to perform operations.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.#ctor(MongoDB.Driver.IMongoDatabase)\">\n            <summary>\n            The constructor taking a <see cref=\"T:MongoDB.Driver.IMongoDatabase\"/>.\n            </summary>\n            <param name=\"mongoDatabase\">A mongodb context implementing <see cref=\"T:MongoDB.Driver.IMongoDatabase\"/></param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.#ctor(MongoDbGenericRepository.IMongoDbContext)\">\n            <summary>\n            The constructor taking a <see cref=\"T:MongoDbGenericRepository.IMongoDbContext\"/>.\n            </summary>\n            <param name=\"mongoDbContext\">A mongodb context implementing <see cref=\"T:MongoDbGenericRepository.IMongoDbContext\"/></param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetByIdAsync``1(`0,System.String)\">\n            <summary>\n            Asynchronously returns one document given its id.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"id\">The Id of the document you want to get.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetById``1(`0,System.String)\">\n            <summary>\n            Returns one document given its id.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"id\">The Id of the document you want to get.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetOneAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously returns one document given an expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetOne``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns one document given an expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetCursor``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns a collection cursor.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.AnyAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns true if any of the document of the collection matches the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.Any``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns true if any of the document of the collection matches the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetAllAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously returns a list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetAll``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns a list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.CountAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously counts how many documents match the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partitionKey</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.Count``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Counts how many documents match the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partitionKey</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetByMaxAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"maxValueSelector\">A property selector to order by descending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetByMax``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"maxValueSelector\">A property selector to order by descending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetByMinAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetByMin``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetMaxValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetMaxValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetMinValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetMinValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.SumByAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Int32}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.SumByAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Decimal}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.SumBy``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Int32}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.SumBy``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Decimal}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.ProjectOneAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Asynchronously returns a projected document matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.ProjectOne``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Returns a projected document matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.ProjectManyAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Asynchronously returns a list of projected documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.ProjectMany``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Asynchronously returns a list of projected documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GroupBy``3(System.Linq.Expressions.Expression{System.Func{``0,``1}},System.Linq.Expressions.Expression{System.Func{System.Linq.IGrouping{``1,``0},``2}},System.String)\">\n            <summary>\n            Groups a collection of documents given a grouping criteria, \n            and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n            <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n            <param name=\"groupingCriteria\">The grouping criteria.</param>\n            <param name=\"groupProjection\">The projected group result.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GroupBy``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.Linq.Expressions.Expression{System.Func{System.Linq.IGrouping{``1,``0},``2}},System.String)\">\n            <summary>\n            Groups filtered a collection of documents given a grouping criteria, \n            and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n            <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"groupingCriteria\">The grouping criteria.</param>\n            <param name=\"groupProjection\">The projected group result.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetSortedPaginatedAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.Boolean,System.Int32,System.Int32,System.String)\">\n            <summary>\n            Asynchronously returns a paginated list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"sortSelector\">The property selector.</param>\n            <param name=\"ascending\">Order of the sorting.</param>\n            <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n            <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository`1.GetSortedPaginatedAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.SortDefinition{``0},System.Int32,System.Int32,System.String)\">\n            <summary>\n            Asynchronously returns a paginated list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"sortDefinition\">The sort definition.</param>\n            <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n            <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateOneAsync``1(``0)\">\n            <summary>\n            Asynchronously Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateOne``1(``0)\">\n            <summary>\n            Updates a document.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"modifiedDocument\">The document with the modifications you want to persist.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateOneAsync``1(``0,MongoDB.Driver.UpdateDefinition{``0})\">\n            <summary>\n            Takes a document you want to modify and applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"update\">The update definition for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateOne``1(``0,MongoDB.Driver.UpdateDefinition{``0})\">\n            <summary>\n            Takes a document you want to modify and applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"update\">The update definition for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateOne``2(``0,System.Linq.Expressions.Expression{System.Func{``0,``1}},``1)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateOneAsync``2(``0,System.Linq.Expressions.Expression{System.Func{``0,``1}},``1)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"documentToModify\">The document you want to modify.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateOne``2(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateOne``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entity selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateOneAsync``2(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            Updates the property field with the given value update a property field in entities.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateOneAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entity selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateManyAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateManyAsync``2(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateManyAsync``1(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateManyAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateMany``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The partition key for the document.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateMany``2(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)\">\n            <summary>\n            For the entities selected by the filter, updates the property field with the given value.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TField\">The type of the field.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"field\">The field selector.</param>\n            <param name=\"value\">The new value of the property field.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateMany``1(MongoDB.Driver.FilterDefinition{``0},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.IBaseMongoRepository_Update`1.UpdateMany``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.UpdateDefinition{``0},System.String)\">\n            <summary>\n            For the entities selected by the filter, applies the update you have defined in MongoDb.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"updateDefinition\">The update definition to apply.</param>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.Models.Document\">\n            <summary>\n            This class represents a basic document that can be stored in MongoDb.\n            Your document must implement this class in order for the MongoDbRepository to handle them.\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Models.Document.#ctor\">\n            <summary>\n            The document constructor\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.Document.Id\">\n            <summary>\n            The Id of the document\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.Document.AddedAtUtc\">\n            <summary>\n            The datetime in UTC at which the document was added.\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.Document.Version\">\n            <summary>\n            The version of the schema of the document\n            </summary>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.Models.IDocument`1\">\n            <summary>\n            This class represents a basic document that can be stored in MongoDb.\n            Your document must implement this class in order for the MongoDbRepository to handle them.\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IDocument`1.Id\">\n            <summary>\n            The Primary Key, which must be decorated with the [BsonId] attribute \n            if you want the MongoDb C# driver to consider it to be the document ID.\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IDocument`1.Version\">\n            <summary>\n            A version number, to indicate the version of the schema.\n            </summary>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.Models.IDocument\">\n            <summary>\n            This class represents a basic document that can be stored in MongoDb.\n            Your document must implement this class in order for the MongoDbRepository to handle them.\n            </summary>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.Models.IndexCreationOptions\">\n            <summary>\n            Options for creating an index.\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IndexCreationOptions.Unique\">\n            <summary>\n            Gets or sets a value indicating whether the index is a unique index.\n            </summary> \n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IndexCreationOptions.TextIndexVersion\">\n            <summary>\n            Gets or sets the index version for text indexes.\n            </summary>  \n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IndexCreationOptions.SphereIndexVersion\">\n            <summary>\n            Gets or sets the index version for 2dsphere indexes.\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IndexCreationOptions.Sparse\">\n            <summary>\n            Gets or sets a value indicating whether the index is a sparse index.\n            </summary>   \n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IndexCreationOptions.Name\">\n            <summary>\n            Gets or sets the index name.\n            </summary>  \n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IndexCreationOptions.Min\">\n            <summary>\n            Gets or sets the min value for 2d indexes.\n            </summary>   \n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IndexCreationOptions.Max\">\n            <summary>\n            Gets or sets the max value for 2d indexes.\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IndexCreationOptions.LanguageOverride\">\n            <summary>\n            Gets or sets the language override.\n            </summary>   \n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IndexCreationOptions.ExpireAfter\">\n            <summary>\n            Gets or sets when documents expire (used with TTL indexes).\n            </summary> \n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IndexCreationOptions.DefaultLanguage\">\n            <summary>\n            Gets or sets the default language.\n            </summary>  \n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IndexCreationOptions.BucketSize\">\n            <summary>\n            Gets or sets the size of a geohash bucket.\n            </summary>   \n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IndexCreationOptions.Bits\">\n            <summary>\n            Gets or sets the precision, in bits, used with geohash indexes.\n            </summary>   \n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IndexCreationOptions.Background\">\n            <summary>\n            Gets or sets a value indicating whether to create the index in the background.\n            </summary> \n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IndexCreationOptions.Version\">\n            <summary>\n            Gets or sets the version of the index.\n            </summary>   \n        </member>\n        <member name=\"T:MongoDbGenericRepository.Models.IPartitionedDocument\">\n            <summary>\n            This class represents a document that can be inserted in a collection that can be partitioned.\n            The partition key allows for the creation of different collections having the same document schema.\n            This can be useful if you are planning to build a Software as a Service (SaaS) Platform, or if you want to reduce indexing.\n            You could for example insert Logs in different collections based on the week and year they where created, or their Log category/source.\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.IPartitionedDocument.PartitionKey\">\n            <summary>\n            The partition key used to partition your collection.\n            </summary>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.Models.PartitionedDocument\">\n            <summary>\n            This class represents a document that can be inserted in a collection that can be partitioned.\n            The partition key allows for the creation of different collections having the same document schema.\n            This can be useful if you are planning to build a Software as a Service (SaaS) Platform, or if you want to reduce indexing.\n            You could for example insert Logs in different collections based on the week and year they where created, or their Log category/source.\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Models.PartitionedDocument.#ctor(System.String)\">\n            <summary>\n            The constructor, it needs a partition key.\n            </summary>\n            <param name=\"partitionKey\"></param>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.Models.PartitionedDocument.PartitionKey\">\n            <summary>\n            The name of the property used for partitioning the collection\n            This will not be inserted into the collection.\n            This partition key will be prepended to the collection name to create a new collection.\n            </summary>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.MongoDbContext\">\n            <summary>\n            The MongoDb context\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.MongoDbContext.Client\">\n            <summary>\n            The IMongoClient from the official MongoDB driver\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.MongoDbContext.Database\">\n            <summary>\n            The IMongoDatabase from the official MongoDB driver\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.MongoDbContext.#ctor(MongoDB.Driver.IMongoDatabase)\">\n            <summary>\n            The constructor of the MongoDbContext, it needs an object implementing <see cref=\"T:MongoDB.Driver.IMongoDatabase\"/>.\n            </summary>\n            <param name=\"mongoDatabase\">An object implementing IMongoDatabase</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.MongoDbContext.#ctor(System.String,System.String)\">\n            <summary>\n            The constructor of the MongoDbContext, it needs a connection string and a database name. \n            </summary>\n            <param name=\"connectionString\">The connections string.</param>\n            <param name=\"databaseName\">The name of your database.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.MongoDbContext.#ctor(System.String)\">\n            <summary>\n            Initialise an instance of a <see cref=\"T:MongoDbGenericRepository.IMongoDbContext\"/> using a connection string\n            </summary>\n            <param name=\"connectionString\"></param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.MongoDbContext.#ctor(MongoDB.Driver.MongoClient,System.String)\">\n            <summary>\n            The constructor of the MongoDbContext, it needs a connection string and a database name. \n            </summary>\n            <param name=\"client\">The MongoClient.</param>\n            <param name=\"databaseName\">The name of your database.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.MongoDbContext.GetCollection``1(System.String)\">\n            <summary>\n            Returns a collection for a document type. Also handles document types with a partition key.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"partitionKey\">The optional value of the partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.MongoDbContext.DropCollection``1(System.String)\">\n            <summary>\n            Drops a collection, use very carefully.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.MongoDbContext.SetGuidRepresentation(MongoDB.Bson.GuidRepresentation)\">\n            <summary>\n            Sets the Guid representation of the MongoDB Driver.\n            </summary>\n            <param name=\"guidRepresentation\">The new value of the GuidRepresentation</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.MongoDbContext.GetAttributeCollectionName``1\">\n            <summary>\n            Extracts the CollectionName attribute from the entity type, if any.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <returns>The name of the collection in which the TDocument is stored.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.MongoDbContext.InitializeGuidRepresentation\">\n            <summary>\n            Initialize the Guid representation of the MongoDB Driver.\n            Override this method to change the default GuidRepresentation.\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.MongoDbContext.GetCollectionName``1(System.String)\">\n            <summary>\n            Given the document type and the partition key, returns the name of the collection it belongs to.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <param name=\"partitionKey\">The value of the partition key.</param>\n            <returns>The name of the collection.</returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.MongoDbContext.Pluralize``1\">\n            <summary>\n            Very naively pluralizes a TDocument type name.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <returns>The pluralized document name.</returns>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.ReadOnlyMongoRepository\">\n            <summary>\n            The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n            Its constructor must be given a connection string and a database name.\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.#ctor(System.String,System.String)\">\n            <summary>\n            The constructor taking a connection string and a database name.\n            </summary>\n            <param name=\"connectionString\">The connection string of the MongoDb server.</param>\n            <param name=\"databaseName\">The name of the database against which you want to perform operations.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.#ctor(MongoDbGenericRepository.IMongoDbContext)\">\n            <summary>\n            The constructor taking a <see cref=\"T:MongoDbGenericRepository.IMongoDbContext\"/>.\n            </summary>\n            <param name=\"mongoDbContext\">A mongodb context implementing <see cref=\"T:MongoDbGenericRepository.IMongoDbContext\"/></param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.#ctor(MongoDB.Driver.IMongoDatabase)\">\n            <summary>\n            The constructor taking a <see cref=\"T:MongoDB.Driver.IMongoDatabase\"/>.\n            </summary>\n            <param name=\"mongoDatabase\">A mongodb context implementing <see cref=\"T:MongoDB.Driver.IMongoDatabase\"/></param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByIdAsync``2(``1,System.String)\">\n            <summary>\n            Asynchronously returns one document given its id.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"id\">The Id of the document you want to get.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetById``2(``1,System.String)\">\n            <summary>\n            Returns one document given its id.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"id\">The Id of the document you want to get.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetOneAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously returns one document given an expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetOne``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns one document given an expression filter.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetCursor``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns a collection cursor.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.AnyAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns true if any of the document of the collection matches the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.Any``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns true if any of the document of the collection matches the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetAllAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously returns a list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetAll``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Returns a list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.CountAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Asynchronously counts how many documents match the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partitionKey</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.Count``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.String)\">\n            <summary>\n            Counts how many documents match the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"partitionKey\">An optional partitionKey</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMaxAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"maxValueSelector\">A property selector to order by descending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMax``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"maxValueSelector\">A property selector to order by descending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMinAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMin``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)\">\n            <summary>\n            Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)\">\n            <summary>\n            Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"maxValueSelector\">A property selector to select the max value.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)\">\n            <summary>\n            Gets the maximum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"maxValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partitionKey.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)\">\n            <summary>\n            Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)\">\n            <summary>\n            Gets the minimum value of a property in a mongodb collections that is satisfying the filter.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <typeparam name=\"TValue\">The type of the value used to order the query.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"minValueSelector\">A property selector to order by ascending.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.SumByAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Int32}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.SumBy``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Int32}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.SumByAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Decimal}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.SumBy``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Decimal}},System.String)\">\n            <summary>\n            Sums the values of a selected field for a given filtered collection of documents.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"selector\">The field you want to sum.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.ProjectOneAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Asynchronously returns a projected document matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.ProjectOne``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Returns a projected document matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.ProjectManyAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Asynchronously returns a list of projected documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.ProjectMany``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)\">\n            <summary>\n            Asynchronously returns a list of projected documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TProjection\">The type representing the model you want to project to.</typeparam>\n            <param name=\"filter\">The document filter.</param>\n            <param name=\"projection\">The projection expression.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GroupBy``4(System.Linq.Expressions.Expression{System.Func{``0,``1}},System.Linq.Expressions.Expression{System.Func{System.Linq.IGrouping{``1,``0},``2}},System.String)\">\n            <summary>\n            Groups filtered a collection of documents given a grouping criteria, \n            and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n            <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n            <param name=\"groupingCriteria\">The grouping criteria.</param>\n            <param name=\"groupProjection\">The projected group result.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GroupBy``4(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.Linq.Expressions.Expression{System.Func{System.Linq.IGrouping{``1,``0},``2}},System.String)\">\n            <summary>\n            Groups filtered a collection of documents given a grouping criteria, \n            and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <typeparam name=\"TGroupKey\">The type of the grouping criteria.</typeparam>\n            <typeparam name=\"TProjection\">The type of the projected group.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"groupingCriteria\">The grouping criteria.</param>\n            <param name=\"groupProjection\">The projected group result.</param>\n            <param name=\"partitionKey\">The partition key of your document, if any.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetSortedPaginatedAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.Boolean,System.Int32,System.Int32,System.String)\">\n            <summary>\n            Asynchronously returns a paginated list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"sortSelector\">The property selector.</param>\n            <param name=\"ascending\">Order of the sorting.</param>\n            <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n            <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetSortedPaginatedAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},MongoDB.Driver.SortDefinition{``0},System.Int32,System.Int32,System.String)\">\n            <summary>\n            Asynchronously returns a paginated list of the documents matching the filter condition.\n            </summary>\n            <typeparam name=\"TDocument\">The type representing a Document.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key for a Document.</typeparam>\n            <param name=\"filter\">A LINQ expression filter.</param>\n            <param name=\"sortDefinition\">The sort definition.</param>\n            <param name=\"skipNumber\">The number of documents you want to skip. Default value is 0.</param>\n            <param name=\"takeNumber\">The number of documents you want to take. Default value is 50.</param>\n            <param name=\"partitionKey\">An optional partition key.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.HandlePartitioned``2(``0)\">\n            <summary>\n            Gets a collections for a potentially partitioned document type.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"document\">The document.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.HandlePartitioned``2(System.String)\">\n            <summary>\n            Gets a collections for a potentially partitioned document type.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"partitionKey\">The collection partition key.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.HandlePartitioned``1(``0)\">\n            <summary>\n            Gets a collections for a potentially partitioned document type.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <param name=\"document\">The document.</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetCollection``2(System.String)\">\n            <summary>\n            Gets a collections for the type TDocument with a partition key.\n            </summary>\n            <typeparam name=\"TDocument\">The document type.</typeparam>\n            <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n            <param name=\"partitionKey\">The collection partition key.</param>\n            <returns></returns>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.Utils.IdGenerator\">\n            <summary>\n            The IdGenerator instance, used to generate Ids of different types.\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.IdGenerator.GetId``1\">\n            <summary>\n            Generates a random value of a given type.\n            </summary>\n            <typeparam name=\"TKey\">The type of the value to generate.</typeparam>\n            <returns>A value of type TKey.</returns>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.Utils.Vocabularies\">\n            <summary>\n            Container for registered Vocabularies.  At present, only a single vocabulary is supported: Default.\n            </summary>\n        </member>\n        <member name=\"P:MongoDbGenericRepository.Utils.Vocabularies.Default\">\n            <summary>\n            The default vocabulary used for singular/plural irregularities.\n            Rules can be added to this vocabulary and will be picked up by called to Singularize() and Pluralize().\n            At this time, multiple vocabularies and removing existing rules are not supported.\n            </summary>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.Utils.Vocabulary\">\n            <summary>\n            A container for exceptions to simple pluralization/singularization rules.\n            Vocabularies.Default contains an extensive list of rules for US English.\n            At this time, multiple vocabularies and removing existing rules are not supported.\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.Vocabulary.AddIrregular(System.String,System.String,System.Boolean)\">\n            <summary>\n            Adds a word to the vocabulary which cannot easily be pluralized/singularized by RegEx, e.g. \"person\" and \"people\".\n            </summary>\n            <param name=\"singular\">The singular form of the irregular word, e.g. \"person\".</param>\n            <param name=\"plural\">The plural form of the irregular word, e.g. \"people\".</param>\n            <param name=\"matchEnding\">True to match these words on their own as well as at the end of longer words. False, otherwise.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.Vocabulary.AddUncountable(System.String)\">\n            <summary>\n            Adds an uncountable word to the vocabulary, e.g. \"fish\".  Will be ignored when plurality is changed.\n            </summary>\n            <param name=\"word\">Word to be added to the list of uncountables.</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.Vocabulary.AddPlural(System.String,System.String)\">\n            <summary>\n            Adds a rule to the vocabulary that does not follow trivial rules for pluralization, e.g. \"bus\" -> \"buses\"\n            </summary>\n            <param name=\"rule\">RegEx to be matched, case insensitive, e.g. \"(bus)es$\"</param>\n            <param name=\"replacement\">RegEx replacement  e.g. \"$1\"</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.Vocabulary.AddSingular(System.String,System.String)\">\n            <summary>\n            Adds a rule to the vocabulary that does not follow trivial rules for singularization, e.g. \"vertices/indices -> \"vertex/index\"\n            </summary>\n            <param name=\"rule\">RegEx to be matched, case insensitive, e.g. \"\"(vert|ind)ices$\"\"</param>\n            <param name=\"replacement\">RegEx replacement  e.g. \"$1ex\"</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.Vocabulary.Pluralize(System.String,System.Boolean)\">\n            <summary>\n            Pluralizes the provided input considering irregular words\n            </summary>\n            <param name=\"word\">Word to be pluralized</param>\n            <param name=\"inputIsKnownToBeSingular\">Normally you call Pluralize on singular words; but if you're unsure call it with false</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.Vocabulary.Singularize(System.String,System.Boolean)\">\n            <summary>\n            Singularizes the provided input considering irregular words\n            </summary>\n            <param name=\"word\">Word to be singularized</param>\n            <param name=\"inputIsKnownToBePlural\">Normally you call Singularize on plural words; but if you're unsure call it with false</param>\n            <returns></returns>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.Utils.InflectorExtensions\">\n            <summary>\n            Inflector extensions\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.InflectorExtensions.Pluralize(System.String,System.Boolean)\">\n            <summary>\n            Pluralizes the provided input considering irregular words\n            </summary>\n            <param name=\"word\">Word to be pluralized</param>\n            <param name=\"inputIsKnownToBeSingular\">Normally you call Pluralize on singular words; but if you're unsure call it with false</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.InflectorExtensions.Singularize(System.String,System.Boolean)\">\n            <summary>\n            Singularizes the provided input considering irregular words\n            </summary>\n            <param name=\"word\">Word to be singularized</param>\n            <param name=\"inputIsKnownToBePlural\">Normally you call Singularize on plural words; but if you're unsure call it with false</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.InflectorExtensions.Pascalize(System.String)\">\n            <summary>\n            By default, pascalize converts strings to UpperCamelCase also removing underscores\n            </summary>\n            <param name=\"input\"></param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.InflectorExtensions.Camelize(System.String)\">\n            <summary>\n            Same as Pascalize except that the first character is lower case\n            </summary>\n            <param name=\"input\"></param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.InflectorExtensions.Underscore(System.String)\">\n            <summary>\n            Separates the input words with underscore\n            </summary>\n            <param name=\"input\">The string to be underscored</param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.InflectorExtensions.Dasherize(System.String)\">\n            <summary>\n            Replaces underscores with dashes in the string\n            </summary>\n            <param name=\"underscoredWord\"></param>\n            <returns></returns>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.InflectorExtensions.Hyphenate(System.String)\">\n            <summary>\n            Replaces underscores with hyphens in the string\n            </summary>\n            <param name=\"underscoredWord\"></param>\n            <returns></returns>\n        </member>\n        <member name=\"T:MongoDbGenericRepository.Utils.RandomExtensions\">\n            <summary>\n            Extensions for the random number generator <see cref=\"T:System.Random\"/>\n            </summary>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.RandomExtensions.NextLong(System.Random,System.Int64,System.Int64)\">\n            <summary>\n            Returns a random long from min (inclusive) to max (exclusive)\n            </summary>\n            <param name=\"random\">The given random instance</param>\n            <param name=\"min\">The inclusive minimum bound</param>\n            <param name=\"max\">The exclusive maximum bound.  Must be greater than min</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.RandomExtensions.NextLong(System.Random,System.Int64)\">\n            <summary>\n            Returns a random long from 0 (inclusive) to max (exclusive)\n            </summary>\n            <param name=\"random\">The given random instance</param>\n            <param name=\"max\">The exclusive maximum bound.  Must be greater than 0</param>\n        </member>\n        <member name=\"M:MongoDbGenericRepository.Utils.RandomExtensions.NextLong(System.Random)\">\n            <summary>\n            Returns a random long over all possible values of long (except long.MaxValue, similar to\n            random.Next())\n            </summary>\n            <param name=\"random\">The given random instance</param>\n        </member>\n    </members>\n</doc>\n"
  },
  {
    "path": "MongoDbGenericRepository/ReadOnlyMongoRepository.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing MongoDB.Driver;\nusing MongoDbGenericRepository.Models;\n\nnamespace MongoDbGenericRepository\n{\n    /// <summary>\n    ///     The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.\n    ///     Its constructor must be given a connection string and a database name.\n    /// </summary>\n    public abstract class ReadOnlyMongoRepository : ReadOnlyMongoRepository<Guid>, IReadOnlyMongoRepository\n    {\n        /// <summary>\n        ///     The constructor taking a connection string and a database name.\n        /// </summary>\n        /// <param name=\"connectionString\">The connection string of the MongoDb server.</param>\n        /// <param name=\"databaseName\">The name of the database against which you want to perform operations.</param>\n        protected ReadOnlyMongoRepository(string connectionString, string databaseName = null) : base(connectionString, databaseName)\n        {\n        }\n\n        /// <summary>\n        ///     The constructor taking a <see cref=\"IMongoDbContext\" />.\n        /// </summary>\n        /// <param name=\"mongoDbContext\">A mongodb context implementing <see cref=\"IMongoDbContext\" /></param>\n        protected ReadOnlyMongoRepository(IMongoDbContext mongoDbContext) : base(mongoDbContext)\n        {\n        }\n\n        /// <summary>\n        ///     The constructor taking a <see cref=\"IMongoDatabase\" />.\n        /// </summary>\n        /// <param name=\"mongoDatabase\">A mongodb context implementing <see cref=\"IMongoDatabase\" /></param>\n        protected ReadOnlyMongoRepository(IMongoDatabase mongoDatabase) : base(mongoDatabase)\n        {\n        }\n\n\n        /// <summary>\n        ///     Gets a collections for a potentially partitioned document type.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"document\">The document.</param>\n        /// <returns></returns>\n        public virtual IMongoCollection<TDocument> HandlePartitioned<TDocument, TKey>(TDocument document)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.HandlePartitioned<TDocument, TKey>(document);\n        }\n\n        /// <summary>\n        ///     Gets a collections for a potentially partitioned document type.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"partitionKey\">The collection partition key.</param>\n        /// <returns></returns>\n        public virtual IMongoCollection<TDocument> HandlePartitioned<TDocument, TKey>(string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            if (!string.IsNullOrEmpty(partitionKey))\n            {\n                return GetCollection<TDocument, TKey>(partitionKey);\n            }\n\n            return GetCollection<TDocument, TKey>();\n        }\n\n        /// <summary>\n        ///     Gets a collections for a potentially partitioned document type.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <param name=\"document\">The document.</param>\n        /// <returns></returns>\n        public virtual IMongoCollection<TDocument> HandlePartitioned<TDocument>(TDocument document)\n            where TDocument : IDocument<Guid>\n        {\n            return MongoDbReader.HandlePartitioned<TDocument, Guid>(document);\n        }\n\n        /// <summary>\n        ///     Gets a collections for the type TDocument with a partition key.\n        /// </summary>\n        /// <typeparam name=\"TDocument\">The document type.</typeparam>\n        /// <typeparam name=\"TKey\">The type of the primary key.</typeparam>\n        /// <param name=\"partitionKey\">The collection partition key.</param>\n        /// <returns></returns>\n        public virtual IMongoCollection<TDocument> GetCollection<TDocument, TKey>(string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.GetCollection<TDocument, TKey>(partitionKey);\n        }\n\n        #region Read TKey\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetByIdAsync<TDocument, TKey>(TKey id)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetByIdAsync<TDocument, TKey>(id, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetByIdAsync<TDocument, TKey>(TKey id, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetByIdAsync<TDocument, TKey>(id, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetByIdAsync<TDocument, TKey>(TKey id, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetByIdAsync<TDocument, TKey>(id, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetByIdAsync<TDocument, TKey>(TKey id, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbReader.GetByIdAsync<TDocument, TKey>(id, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetById<TDocument, TKey>(TKey id)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetById<TDocument, TKey>(id, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetById<TDocument, TKey>(TKey id, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetById<TDocument, TKey>(id, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetById<TDocument, TKey>(TKey id, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetById<TDocument, TKey>(id, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetById<TDocument, TKey>(TKey id, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.GetById<TDocument, TKey>(id, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return GetOneAsync<TDocument, TKey>(condition, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return GetOneAsync<TDocument, TKey>(condition, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return GetOneAsync<TDocument, TKey>(condition, findOption, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return GetOneAsync<TDocument, TKey>(condition, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return GetOneAsync<TDocument, TKey>(condition, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return GetOneAsync<TDocument, TKey>(condition, findOption, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, string partitionKey)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return GetOneAsync<TDocument, TKey>(condition, findOption, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<TDocument> GetOneAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.GetOneAsync<TDocument, TKey>(condition, findOption, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return GetOne<TDocument, TKey>(condition, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return GetOne<TDocument, TKey>(condition, findOption, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return GetOne<TDocument, TKey>(condition, null, partitionKey, CancellationToken.None);\n        }\n\n\n        /// <inheritdoc />\n        public TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, string partitionKey)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return GetOne<TDocument, TKey>(condition, findOption, partitionKey, CancellationToken.None);\n        }\n\n\n        /// <inheritdoc />\n        public TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return GetOne<TDocument, TKey>(condition, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return GetOne<TDocument, TKey>(condition, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return GetOne<TDocument, TKey>(condition, findOption, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public TDocument GetOne<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey> where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.GetOne<TDocument, TKey>(condition, findOption, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetOneAsync<TDocument, TKey>(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetOneAsync<TDocument, TKey>(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetOneAsync<TDocument, TKey>(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetOneAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbReader.GetOneAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetOne<TDocument, TKey>(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetOne<TDocument, TKey>(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetOne<TDocument, TKey>(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.GetOne<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual IFindFluent<TDocument, TDocument> GetCursor<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.GetCursor<TDocument, TKey>(filter, partitionKey);\n        }\n\n        /// <inheritdoc />\n        public Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return AnyAsync<TDocument, TKey>(condition, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return AnyAsync<TDocument, TKey>(condition, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return AnyAsync<TDocument, TKey>(condition, countOption, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return AnyAsync<TDocument, TKey>(condition, countOption, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return AnyAsync<TDocument, TKey>(condition, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return AnyAsync<TDocument, TKey>(condition, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return AnyAsync<TDocument, TKey>(condition, countOption, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public Task<bool> AnyAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            CountOptions countOption,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.AnyAsync<TDocument, TKey>(condition, countOption, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Any<TDocument, TKey>(condition, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Any<TDocument, TKey>(condition, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Any<TDocument, TKey>(condition, countOption, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.Any<TDocument, TKey>(condition, countOption, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Any<TDocument, TKey>(condition, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Any<TDocument, TKey>(condition, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Any<TDocument, TKey>(condition, countOption, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public bool Any<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            CountOptions countOption,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.Any<TDocument, TKey>(condition, countOption, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> AnyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await AnyAsync<TDocument, TKey>(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> AnyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await AnyAsync<TDocument, TKey>(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> AnyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await AnyAsync<TDocument, TKey>(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<bool> AnyAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbReader.AnyAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool Any<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.Any<TDocument, TKey>(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool Any<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.Any<TDocument, TKey>(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual bool Any<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Any<TDocument, TKey>(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual bool Any<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.Any<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAllAsync<TDocument, TKey>(condition, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAllAsync<TDocument, TKey>(condition, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAllAsync<TDocument, TKey>(condition, findOption, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAllAsync<TDocument, TKey>(condition, findOption, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAllAsync<TDocument, TKey>(condition, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public Task<List<TDocument>> GetAllAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAllAsync<TDocument, TKey>(condition, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public Task<List<TDocument>> GetAllAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAllAsync<TDocument, TKey>(condition, findOption, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public Task<List<TDocument>> GetAllAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.GetAllAsync<TDocument, TKey>(condition, findOption, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAll<TDocument, TKey>(condition, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAll<TDocument, TKey>(condition, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAll<TDocument, TKey>(condition, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAll<TDocument, TKey>(condition, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAll<TDocument, TKey>(condition, findOption, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAll<TDocument, TKey>(condition, findOption, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAll<TDocument, TKey>(condition, findOption, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public List<TDocument> GetAll<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            FindOptions findOption,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.GetAll<TDocument, TKey>(condition, findOption, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TDocument>> GetAllAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetAllAsync<TDocument, TKey>(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TDocument>> GetAllAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetAllAsync<TDocument, TKey>(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TDocument>> GetAllAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetAllAsync<TDocument, TKey>(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TDocument>> GetAllAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbReader.GetAllAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TDocument> GetAll<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAll<TDocument, TKey>(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TDocument> GetAll<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAll<TDocument, TKey>(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TDocument> GetAll<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetAll<TDocument, TKey>(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TDocument> GetAll<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.GetAll<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return CountAsync<TDocument, TKey>(condition, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return CountAsync<TDocument, TKey>(condition, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return CountAsync<TDocument, TKey>(condition, countOption, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return CountAsync<TDocument, TKey>(condition, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return CountAsync<TDocument, TKey>(condition, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return CountAsync<TDocument, TKey>(condition, countOption, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return CountAsync<TDocument, TKey>(condition, countOption, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public Task<long> CountAsync<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            CountOptions countOption,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.CountAsync<TDocument, TKey>(condition, countOption, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public long Count<TDocument, TKey>(FilterDefinition<TDocument> condition)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Count<TDocument, TKey>(condition, null, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public long Count<TDocument, TKey>(FilterDefinition<TDocument> condition, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Count<TDocument, TKey>(condition, null, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public long Count<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Count<TDocument, TKey>(condition, null, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public long Count<TDocument, TKey>(FilterDefinition<TDocument> condition, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Count<TDocument, TKey>(condition, null, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public long Count<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Count<TDocument, TKey>(condition, countOption, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public long Count<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Count<TDocument, TKey>(condition, countOption, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public long Count<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Count<TDocument, TKey>(condition, countOption, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public long Count<TDocument, TKey>(\n            FilterDefinition<TDocument> condition,\n            CountOptions countOption,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.Count<TDocument, TKey>(condition, countOption, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> CountAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CountAsync<TDocument, TKey>(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> CountAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CountAsync<TDocument, TKey>(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> CountAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await CountAsync<TDocument, TKey>(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<long> CountAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbReader.CountAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long Count<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Count<TDocument, TKey>(filter, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long Count<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Count<TDocument, TKey>(filter, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual long Count<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return Count<TDocument, TKey>(filter, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual long Count<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.Count<TDocument, TKey>(filter, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetByMaxAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetByMaxAsync<TDocument, TKey>(filter, maxValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetByMaxAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetByMaxAsync<TDocument, TKey>(filter, maxValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetByMaxAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetByMaxAsync<TDocument, TKey>(filter, maxValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetByMaxAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbReader.GetByMaxAsync<TDocument, TKey>(filter, maxValueSelector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetByMax<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetByMax<TDocument, TKey>(filter, maxValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetByMax<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetByMax<TDocument, TKey>(filter, maxValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetByMax<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetByMax<TDocument, TKey>(filter, maxValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetByMax<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> maxValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.GetByMax<TDocument, TKey>(filter, maxValueSelector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetByMinAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetByMinAsync<TDocument, TKey>(filter, minValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetByMinAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetByMinAsync<TDocument, TKey>(filter, minValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetByMinAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetByMinAsync<TDocument, TKey>(filter, minValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TDocument> GetByMinAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbReader.GetByMinAsync<TDocument, TKey>(filter, minValueSelector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetByMin<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetByMin<TDocument, TKey>(filter, minValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetByMin<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetByMin<TDocument, TKey>(filter, minValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetByMin<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetByMin<TDocument, TKey>(filter, minValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TDocument GetByMin<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> minValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.GetByMin<TDocument, TKey>(filter, minValueSelector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetMaxValueAsync<TDocument, TKey, TValue>(filter, maxValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetMaxValueAsync<TDocument, TKey, TValue>(filter, maxValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetMaxValueAsync<TDocument, TKey, TValue>(filter, maxValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbReader.GetMaxValueAsync<TDocument, TKey, TValue>(filter, maxValueSelector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TValue GetMaxValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetMaxValue<TDocument, TKey, TValue>(filter, maxValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TValue GetMaxValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetMaxValue<TDocument, TKey, TValue>(filter, maxValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TValue GetMaxValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetMaxValue<TDocument, TKey, TValue>(filter, maxValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TValue GetMaxValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> maxValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.GetMaxValue<TDocument, TKey, TValue>(filter, maxValueSelector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetMinValueAsync<TDocument, TKey, TValue>(filter, minValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetMinValueAsync<TDocument, TKey, TValue>(filter, minValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await GetMinValueAsync<TDocument, TKey, TValue>(filter, minValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbReader.GetMinValueAsync<TDocument, TKey, TValue>(filter, minValueSelector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TValue GetMinValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetMinValue<TDocument, TKey, TValue>(filter, minValueSelector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TValue GetMinValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetMinValue<TDocument, TKey, TValue>(filter, minValueSelector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TValue GetMinValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return GetMinValue<TDocument, TKey, TValue>(filter, minValueSelector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TValue GetMinValue<TDocument, TKey, TValue>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TValue>> minValueSelector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.GetMinValue<TDocument, TKey, TValue>(filter, minValueSelector, partitionKey, cancellationToken);\n        }\n\n        #endregion\n\n        #region Sum TKey\n\n        /// <inheritdoc />\n        public virtual async Task<int> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await SumByAsync<TDocument, TKey>(filter, selector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<int> SumByAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await SumByAsync<TDocument, TKey>(filter, selector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<int> SumByAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await SumByAsync<TDocument, TKey>(filter, selector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<int> SumByAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbReader.SumByAsync<TDocument, TKey>(filter, selector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual int SumBy<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, int>> selector,\n            string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.SumBy<TDocument, TKey>(filter, selector, partitionKey);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<decimal> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, decimal>> selector)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await SumByAsync<TDocument, TKey>(filter, selector, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<decimal> SumByAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await SumByAsync<TDocument, TKey>(filter, selector, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<decimal> SumByAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await SumByAsync<TDocument, TKey>(filter, selector, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<decimal> SumByAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await MongoDbReader.SumByAsync<TDocument, TKey>(filter, selector, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual decimal SumBy<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, decimal>> selector,\n            string partitionKey = null)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return MongoDbReader.SumBy<TDocument, TKey>(filter, selector, partitionKey);\n        }\n\n        #endregion Sum TKey\n\n        #region Project TKey\n\n        /// <inheritdoc />\n        public virtual async Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return await ProjectOneAsync<TDocument, TProjection, TKey>(filter, projection, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return await ProjectOneAsync<TDocument, TProjection, TKey>(filter, projection, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return await ProjectOneAsync<TDocument, TProjection, TKey>(filter, projection, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return await MongoDbReader.ProjectOneAsync<TDocument, TProjection, TKey>(filter, projection, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TProjection ProjectOne<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return ProjectOne<TDocument, TProjection, TKey>(filter, projection, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TProjection ProjectOne<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return ProjectOne<TDocument, TProjection, TKey>(filter, projection, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual TProjection ProjectOne<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return ProjectOne<TDocument, TProjection, TKey>(filter, projection, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual TProjection ProjectOne<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return MongoDbReader.ProjectOne<TDocument, TProjection, TKey>(filter, projection, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return await ProjectManyAsync<TDocument, TProjection, TKey>(filter, projection, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return await ProjectManyAsync<TDocument, TProjection, TKey>(filter, projection, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return await ProjectManyAsync<TDocument, TProjection, TKey>(filter, projection, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return await MongoDbReader.ProjectManyAsync<TDocument, TProjection, TKey>(filter, projection, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> ProjectMany<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return ProjectMany<TDocument, TProjection, TKey>(filter, projection, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> ProjectMany<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return ProjectMany<TDocument, TProjection, TKey>(filter, projection, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> ProjectMany<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return ProjectMany<TDocument, TProjection, TKey>(filter, projection, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> ProjectMany<TDocument, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TProjection>> projection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class\n        {\n            return MongoDbReader.ProjectMany<TDocument, TProjection, TKey>(filter, projection, partitionKey, cancellationToken);\n        }\n\n        #endregion Project TKey\n\n        #region Group By TKey\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new()\n        {\n            return GroupBy<TDocument, TGroupKey, TProjection, TKey>(groupingCriteria, groupProjection, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new()\n        {\n            return GroupBy<TDocument, TGroupKey, TProjection, TKey>(groupingCriteria, groupProjection, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new()\n        {\n            return GroupBy<TDocument, TGroupKey, TProjection, TKey>(groupingCriteria, groupProjection, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new()\n        {\n            return MongoDbReader.GroupBy<TDocument, TGroupKey, TProjection, TKey>(groupingCriteria, groupProjection, partitionKey, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new()\n        {\n            return GroupBy<TDocument, TGroupKey, TProjection, TKey>(filter, groupingCriteria, groupProjection, null, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new()\n        {\n            return GroupBy<TDocument, TGroupKey, TProjection, TKey>(filter, groupingCriteria, groupProjection, null, cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new()\n        {\n            return GroupBy<TDocument, TGroupKey, TProjection, TKey>(filter, groupingCriteria, groupProjection, partitionKey, CancellationToken.None);\n        }\n\n        /// <inheritdoc />\n        public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, TGroupKey>> groupingCriteria,\n            Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,\n            string partitionKey,\n            CancellationToken cancellationToken)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n            where TProjection : class, new()\n        {\n            return MongoDbReader.GroupBy<TDocument, TGroupKey, TProjection, TKey>(filter, groupingCriteria, groupProjection, partitionKey, cancellationToken);\n        }\n\n        #endregion Group By TKey\n\n        #region Pagination\n\n        /// <inheritdoc />\n        public virtual async Task<List<TDocument>> GetSortedPaginatedAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            Expression<Func<TDocument, object>> sortSelector,\n            bool ascending = true,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            var sorting = ascending\n                ? Builders<TDocument>.Sort.Ascending(sortSelector)\n                : Builders<TDocument>.Sort.Descending(sortSelector);\n\n            return await HandlePartitioned<TDocument, TKey>(partitionKey)\n                .Find(filter)\n                .Sort(sorting)\n                .Skip(skipNumber)\n                .Limit(takeNumber)\n                .ToListAsync(cancellationToken);\n        }\n\n        /// <inheritdoc />\n        public virtual async Task<List<TDocument>> GetSortedPaginatedAsync<TDocument, TKey>(\n            Expression<Func<TDocument, bool>> filter,\n            SortDefinition<TDocument> sortDefinition,\n            int skipNumber = 0,\n            int takeNumber = 50,\n            string partitionKey = null,\n            CancellationToken cancellationToken = default)\n            where TDocument : IDocument<TKey>\n            where TKey : IEquatable<TKey>\n        {\n            return await HandlePartitioned<TDocument, TKey>(partitionKey)\n                .Find(filter)\n                .Sort(sortDefinition)\n                .Skip(skipNumber)\n                .Limit(takeNumber)\n                .ToListAsync(cancellationToken);\n        }\n\n        #endregion Pagination\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/Utils/IdGenerator.cs",
    "content": "﻿using MongoDB.Bson;\nusing System;\n\nnamespace MongoDbGenericRepository.Utils\n{\n    /// <summary>\n    /// The IdGenerator instance, used to generate Ids of different types.\n    /// </summary>\n    public static class IdGenerator\n    {\n        private static readonly Random Random = new Random();\n\n        /// <summary>\n        /// Generates a random value of a given type.\n        /// </summary>\n        /// <typeparam name=\"TKey\">The type of the value to generate.</typeparam>\n        /// <returns>A value of type TKey.</returns>\n        public static TKey GetId<TKey>()\n        {\n            var idTypeName = typeof(TKey).Name;\n            switch (idTypeName)\n            {\n                case \"Guid\":\n                    return (TKey)(object)Guid.NewGuid();\n                case \"Int16\":\n                    return (TKey)(object)Random.Next(1, short.MaxValue);\n                case \"Int32\":\n                    return (TKey)(object)Random.Next(1, int.MaxValue);\n                case \"Int64\":\n                    return (TKey)(object)(Random.NextLong(1, long.MaxValue));\n                case \"String\":\n                    return (TKey)(object)Guid.NewGuid().ToString();\n                case \"ObjectId\":\n                    return (TKey)(object)ObjectId.GenerateNewId();\n            }\n            throw new ArgumentException($\"{idTypeName} is not a supported Id type, the Id of the document cannot be set.\");\n        }\n    }\n}\n"
  },
  {
    "path": "MongoDbGenericRepository/Utils/Pluralization.cs",
    "content": "﻿//The Inflector class was cloned from Inflector (https://github.com/srkirkland/Inflector)\n\n//The MIT License (MIT)\n\n//Copyright (c) 2013 Scott Kirkland\n\n//Permission is hereby granted, free of charge, to any person obtaining a copy of\n//this software and associated documentation files (the \"Software\"), to deal in\n//the Software without restriction, including without limitation the rights to\n//use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n//the Software, and to permit persons to whom the Software is furnished to do so,\n//subject to the following conditions:\n\n//The above copyright notice and this permission notice shall be included in all\n//copies or substantial portions of the Software.\n\n//THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n//FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n//COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n//IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n//CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n//Vocabulary and Vocabularies classes were copied from Humanizer.Inflections (https://github.com/Humanizr/Humanizer)\n//The MIT License(MIT)\n\n//Copyright(c) 2012-2014 Mehdi Khalili\n\n//Permission is hereby granted, free of charge, to any person obtaining a copy\n//of this software and associated documentation files (the \"Software\"), to deal\n//in the Software without restriction, including without limitation the rights\n//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//copies of the Software, and to permit persons to whom the Software is\n//furnished to do so, subject to the following conditions:\n\n//The above copyright notice and this permission notice shall be included in\n//all copies or substantial portions of the Software.\n\n//THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//THE SOFTWARE.\n\n//==============================================================================\n\n//Inflector (https://github.com/srkirkland/Inflector)\n//The MIT License (MIT)\n//Copyright (c) 2013 Scott Kirkland\n\n//==============================================================================\n\n//ByteSize (https://github.com/omar/ByteSize)\n//The MIT License (MIT)\n//Copyright (c) 2013-2014 Omar Khudeira (http://omar.io)\n\n//==============================================================================\n\nusing System;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace MongoDbGenericRepository.Utils\n{\n    /// <summary>\n    /// Container for registered Vocabularies.  At present, only a single vocabulary is supported: Default.\n    /// </summary>\n    public static class Vocabularies\n    {\n        private static readonly Lazy<Vocabulary> Instance;\n\n        static Vocabularies()\n        {\n            Instance = new Lazy<Vocabulary>(BuildDefault, LazyThreadSafetyMode.PublicationOnly);\n        }\n\n        /// <summary>\n        /// The default vocabulary used for singular/plural irregularities.\n        /// Rules can be added to this vocabulary and will be picked up by called to Singularize() and Pluralize().\n        /// At this time, multiple vocabularies and removing existing rules are not supported.\n        /// </summary>\n        public static Vocabulary Default => Instance.Value;\n\n        private static Vocabulary BuildDefault()\n        {\n            var _default = new Vocabulary();\n\n            _default.AddPlural(\"$\", \"s\");\n            _default.AddPlural(\"s$\", \"s\");\n            _default.AddPlural(\"(ax|test)is$\", \"$1es\");\n            _default.AddPlural(\"(octop|vir|alumn|fung|cact|foc|hippopotam|radi|stimul|syllab|nucle)us$\", \"$1i\");\n            _default.AddPlural(\"(alias|bias|iris|status|campus|apparatus|virus|walrus|trellis)$\", \"$1es\");\n            _default.AddPlural(\"(buffal|tomat|volcan|ech|embarg|her|mosquit|potat|torped|vet)o$\", \"$1oes\");\n            _default.AddPlural(\"([dti])um$\", \"$1a\");\n            _default.AddPlural(\"sis$\", \"ses\");\n            _default.AddPlural(\"(?:([^f])fe|([lr])f)$\", \"$1$2ves\");\n            _default.AddPlural(\"(hive)$\", \"$1s\");\n            _default.AddPlural(\"([^aeiouy]|qu)y$\", \"$1ies\");\n            _default.AddPlural(\"(x|ch|ss|sh)$\", \"$1es\");\n            _default.AddPlural(\"(matr|vert|ind|d)ix|ex$\", \"$1ices\");\n            _default.AddPlural(\"([m|l])ouse$\", \"$1ice\");\n            _default.AddPlural(\"^(ox)$\", \"$1en\");\n            _default.AddPlural(\"(quiz)$\", \"$1zes\");\n            _default.AddPlural(\"(buz|blit|walt)z$\", \"$1zes\");\n            _default.AddPlural(\"(hoo|lea|loa|thie)f$\", \"$1ves\");\n            _default.AddPlural(\"(alumn|alg|larv|vertebr)a$\", \"$1ae\");\n            _default.AddPlural(\"(criteri|phenomen)on$\", \"$1a\");\n\n            _default.AddSingular(\"s$\", \"\");\n            _default.AddSingular(\"(n)ews$\", \"$1ews\");\n            _default.AddSingular(\"([dti])a$\", \"$1um\");\n            _default.AddSingular(\"(analy|ba|diagno|parenthe|progno|synop|the|ellip|empha|neuro|oa|paraly)ses$\", \"$1sis\");\n            _default.AddSingular(\"([^f])ves$\", \"$1fe\");\n            _default.AddSingular(\"(hive)s$\", \"$1\");\n            _default.AddSingular(\"(tive)s$\", \"$1\");\n            _default.AddSingular(\"([lr]|hoo|lea|loa|thie)ves$\", \"$1f\");\n            _default.AddSingular(\"(^zomb)?([^aeiouy]|qu)ies$\", \"$2y\");\n            _default.AddSingular(\"(s)eries$\", \"$1eries\");\n            _default.AddSingular(\"(m)ovies$\", \"$1ovie\");\n            _default.AddSingular(\"(x|ch|ss|sh)es$\", \"$1\");\n            _default.AddSingular(\"([m|l])ice$\", \"$1ouse\");\n            _default.AddSingular(\"(o)es$\", \"$1\");\n            _default.AddSingular(\"(shoe)s$\", \"$1\");\n            _default.AddSingular(\"(cris|ax|test)es$\", \"$1is\");\n            _default.AddSingular(\"(octop|vir|alumn|fung|cact|foc|hippopotam|radi|stimul|syllab|nucle)i$\", \"$1us\");\n            _default.AddSingular(\"(alias|bias|iris|status|campus|apparatus|virus|walrus|trellis)es$\", \"$1\");\n            _default.AddSingular(\"^(ox)en\", \"$1\");\n            _default.AddSingular(\"(matr|d)ices$\", \"$1ix\");\n            _default.AddSingular(\"(vert|ind)ices$\", \"$1ex\");\n            _default.AddSingular(\"(quiz)zes$\", \"$1\");\n            _default.AddSingular(\"(buz|blit|walt)zes$\", \"$1z\");\n            _default.AddSingular(\"(alumn|alg|larv|vertebr)ae$\", \"$1a\");\n            _default.AddSingular(\"(criteri|phenomen)a$\", \"$1on\");\n\n            _default.AddIrregular(\"person\", \"people\");\n            _default.AddIrregular(\"man\", \"men\");\n            _default.AddIrregular(\"child\", \"children\");\n            _default.AddIrregular(\"sex\", \"sexes\");\n            _default.AddIrregular(\"move\", \"moves\");\n            _default.AddIrregular(\"goose\", \"geese\");\n            _default.AddIrregular(\"wave\", \"waves\");\n            _default.AddIrregular(\"die\", \"dice\");\n            _default.AddIrregular(\"foot\", \"feet\");\n            _default.AddIrregular(\"tooth\", \"teeth\");\n            _default.AddIrregular(\"curriculum\", \"curricula\");\n            _default.AddIrregular(\"database\", \"databases\");\n            _default.AddIrregular(\"zombie\", \"zombies\");\n\n            _default.AddIrregular(\"is\", \"are\", matchEnding: false);\n            _default.AddIrregular(\"that\", \"those\", matchEnding: false);\n            _default.AddIrregular(\"this\", \"these\", matchEnding: false);\n            _default.AddIrregular(\"bus\", \"buses\", matchEnding: false);\n\n            _default.AddUncountable(\"equipment\");\n            _default.AddUncountable(\"information\");\n            _default.AddUncountable(\"rice\");\n            _default.AddUncountable(\"money\");\n            _default.AddUncountable(\"species\");\n            _default.AddUncountable(\"series\");\n            _default.AddUncountable(\"fish\");\n            _default.AddUncountable(\"sheep\");\n            _default.AddUncountable(\"deer\");\n            _default.AddUncountable(\"aircraft\");\n            _default.AddUncountable(\"oz\");\n            _default.AddUncountable(\"tsp\");\n            _default.AddUncountable(\"tbsp\");\n            _default.AddUncountable(\"ml\");\n            _default.AddUncountable(\"l\");\n            _default.AddUncountable(\"water\");\n            _default.AddUncountable(\"waters\");\n            _default.AddUncountable(\"semen\");\n            _default.AddUncountable(\"sperm\");\n            _default.AddUncountable(\"bison\");\n            _default.AddUncountable(\"grass\");\n            _default.AddUncountable(\"hair\");\n            _default.AddUncountable(\"mud\");\n            _default.AddUncountable(\"elk\");\n            _default.AddUncountable(\"luggage\");\n            _default.AddUncountable(\"moose\");\n            _default.AddUncountable(\"offspring\");\n            _default.AddUncountable(\"salmon\");\n            _default.AddUncountable(\"shrimp\");\n            _default.AddUncountable(\"someone\");\n            _default.AddUncountable(\"swine\");\n            _default.AddUncountable(\"trout\");\n            _default.AddUncountable(\"tuna\");\n            _default.AddUncountable(\"corps\");\n            _default.AddUncountable(\"scissors\");\n            _default.AddUncountable(\"means\");\n\n            return _default;\n        }\n    }\n    /// <summary>\n    /// A container for exceptions to simple pluralization/singularization rules.\n    /// Vocabularies.Default contains an extensive list of rules for US English.\n    /// At this time, multiple vocabularies and removing existing rules are not supported.\n    /// </summary>\n    public class Vocabulary\n    {\n        internal Vocabulary()\n        {\n        }\n\n        private readonly List<Rule> _plurals = new List<Rule>();\n        private readonly List<Rule> _singulars = new List<Rule>();\n        private readonly List<string> _uncountables = new List<string>();\n\n        /// <summary>\n        /// Adds a word to the vocabulary which cannot easily be pluralized/singularized by RegEx, e.g. \"person\" and \"people\".\n        /// </summary>\n        /// <param name=\"singular\">The singular form of the irregular word, e.g. \"person\".</param>\n        /// <param name=\"plural\">The plural form of the irregular word, e.g. \"people\".</param>\n        /// <param name=\"matchEnding\">True to match these words on their own as well as at the end of longer words. False, otherwise.</param>\n        public void AddIrregular(string singular, string plural, bool matchEnding = true)\n        {\n            if (matchEnding)\n            {\n                AddPlural(\"(\" + singular[0] + \")\" + singular.Substring(1) + \"$\", \"$1\" + plural.Substring(1));\n                AddSingular(\"(\" + plural[0] + \")\" + plural.Substring(1) + \"$\", \"$1\" + singular.Substring(1));\n            }\n            else\n            {\n                AddPlural($\"^{singular}$\", plural);\n                AddSingular($\"^{plural}$\", singular);\n            }\n        }\n\n        /// <summary>\n        /// Adds an uncountable word to the vocabulary, e.g. \"fish\".  Will be ignored when plurality is changed.\n        /// </summary>\n        /// <param name=\"word\">Word to be added to the list of uncountables.</param>\n        public void AddUncountable(string word)\n        {\n            _uncountables.Add(word.ToLower());\n        }\n\n        /// <summary>\n        /// Adds a rule to the vocabulary that does not follow trivial rules for pluralization, e.g. \"bus\" -> \"buses\"\n        /// </summary>\n        /// <param name=\"rule\">RegEx to be matched, case insensitive, e.g. \"(bus)es$\"</param>\n        /// <param name=\"replacement\">RegEx replacement  e.g. \"$1\"</param>\n        public void AddPlural(string rule, string replacement)\n        {\n            _plurals.Add(new Rule(rule, replacement));\n        }\n\n        /// <summary>\n        /// Adds a rule to the vocabulary that does not follow trivial rules for singularization, e.g. \"vertices/indices -> \"vertex/index\"\n        /// </summary>\n        /// <param name=\"rule\">RegEx to be matched, case insensitive, e.g. \"\"(vert|ind)ices$\"\"</param>\n        /// <param name=\"replacement\">RegEx replacement  e.g. \"$1ex\"</param>\n        public void AddSingular(string rule, string replacement)\n        {\n            _singulars.Add(new Rule(rule, replacement));\n        }\n\n        /// <summary>\n        /// Pluralizes the provided input considering irregular words\n        /// </summary>\n        /// <param name=\"word\">Word to be pluralized</param>\n        /// <param name=\"inputIsKnownToBeSingular\">Normally you call Pluralize on singular words; but if you're unsure call it with false</param>\n        /// <returns></returns>\n        public string Pluralize(string word, bool inputIsKnownToBeSingular = true)\n        {\n            var result = ApplyRules(_plurals, word);\n\n            if (inputIsKnownToBeSingular)\n                return result;\n\n            var asSingular = ApplyRules(_singulars, word);\n            var asSingularAsPlural = ApplyRules(_plurals, asSingular);\n            if (asSingular != null && asSingular != word && asSingular + \"s\" != word && asSingularAsPlural == word && result != word)\n                return word;\n\n            return result;\n        }\n\n        /// <summary>\n        /// Singularizes the provided input considering irregular words\n        /// </summary>\n        /// <param name=\"word\">Word to be singularized</param>\n        /// <param name=\"inputIsKnownToBePlural\">Normally you call Singularize on plural words; but if you're unsure call it with false</param>\n        /// <returns></returns>\n        public string Singularize(string word, bool inputIsKnownToBePlural = true)\n        {\n            var result = ApplyRules(_singulars, word);\n\n            if (inputIsKnownToBePlural)\n                return result;\n\n            // the Plurality is unknown so we should check all possibilities\n            var asPlural = ApplyRules(_plurals, word);\n            var asPluralAsSingular = ApplyRules(_singulars, asPlural);\n            if (asPlural != word && word + \"s\" != asPlural && asPluralAsSingular == word && result != word)\n                return word;\n\n            return result ?? word;\n        }\n\n        private string ApplyRules(IList<Rule> rules, string word)\n        {\n            if (word == null)\n                return null;\n\n            if (IsUncountable(word))\n                return word;\n\n            var result = word;\n            for (var i = rules.Count - 1; i >= 0; i--)\n            {\n                if ((result = rules[i].Apply(word)) != null)\n                    break;\n            }\n            return result;\n        }\n\n        private bool IsUncountable(string word)\n        {\n            return _uncountables.Contains(word.ToLower());\n        }\n\n        private class Rule\n        {\n            private readonly Regex _regex;\n            private readonly string _replacement;\n\n            public Rule(string pattern, string replacement)\n            {\n                _regex = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.Compiled);\n                _replacement = replacement;\n            }\n\n            public string Apply(string word)\n            {\n                if (!_regex.IsMatch(word))\n                    return null;\n\n                return _regex.Replace(word, _replacement);\n            }\n        }\n    }\n\n    /// <summary>\n    /// Inflector extensions\n    /// </summary>\n    public static class InflectorExtensions\n    {\n        /// <summary>\n        /// Pluralizes the provided input considering irregular words\n        /// </summary>\n        /// <param name=\"word\">Word to be pluralized</param>\n        /// <param name=\"inputIsKnownToBeSingular\">Normally you call Pluralize on singular words; but if you're unsure call it with false</param>\n        /// <returns></returns>\n        public static string Pluralize(this string word, bool inputIsKnownToBeSingular = true)\n        {\n            return Vocabularies.Default.Pluralize(word, inputIsKnownToBeSingular);\n        }\n\n        /// <summary>\n        /// Singularizes the provided input considering irregular words\n        /// </summary>\n        /// <param name=\"word\">Word to be singularized</param>\n        /// <param name=\"inputIsKnownToBePlural\">Normally you call Singularize on plural words; but if you're unsure call it with false</param>\n        /// <returns></returns>\n        public static string Singularize(this string word, bool inputIsKnownToBePlural = true)\n        {\n            return Vocabularies.Default.Singularize(word, inputIsKnownToBePlural);\n        }\n\n        /// <summary>\n        /// By default, pascalize converts strings to UpperCamelCase also removing underscores\n        /// </summary>\n        /// <param name=\"input\"></param>\n        /// <returns></returns>\n        public static string Pascalize(this string input)\n        {\n            return Regex.Replace(input, \"(?:^|_)(.)\", match => match.Groups[1].Value.ToUpper());\n        }\n\n        /// <summary>\n        /// Same as Pascalize except that the first character is lower case\n        /// </summary>\n        /// <param name=\"input\"></param>\n        /// <returns></returns>\n        public static string Camelize(this string input)\n        {\n            var word = Pascalize(input);\n            return word.Substring(0, 1).ToLower() + word.Substring(1);\n        }\n\n        /// <summary>\n        /// Separates the input words with underscore\n        /// </summary>\n        /// <param name=\"input\">The string to be underscored</param>\n        /// <returns></returns>\n        public static string Underscore(this string input)\n        {\n            return Regex.Replace(\n                Regex.Replace(\n                    Regex.Replace(input, @\"([A-Z]+)([A-Z][a-z])\", \"$1_$2\"), @\"([a-z\\d])([A-Z])\", \"$1_$2\"), @\"[-\\s]\", \"_\").ToLower();\n        }\n\n        /// <summary>\n        /// Replaces underscores with dashes in the string\n        /// </summary>\n        /// <param name=\"underscoredWord\"></param>\n        /// <returns></returns>\n        public static string Dasherize(this string underscoredWord)\n        {\n            return underscoredWord.Replace('_', '-');\n        }\n\n        /// <summary>\n        /// Replaces underscores with hyphens in the string\n        /// </summary>\n        /// <param name=\"underscoredWord\"></param>\n        /// <returns></returns>\n        public static string Hyphenate(this string underscoredWord)\n        {\n            return Dasherize(underscoredWord);\n        }\n    }\n}"
  },
  {
    "path": "MongoDbGenericRepository/Utils/RandomExtensions.cs",
    "content": "﻿using System;\n\nnamespace MongoDbGenericRepository.Utils\n{\n    // Thanks BlueRaja - Danny Pflughoeft https://stackoverflow.com/a/13095144/5103354\n    /// <summary>\n    /// Extensions for the random number generator <see cref=\"Random\"/>\n    /// </summary>\n    public static class RandomExtensions\n    {\n        /// <summary>\n        /// Returns a random long from min (inclusive) to max (exclusive)\n        /// </summary>\n        /// <param name=\"random\">The given random instance</param>\n        /// <param name=\"min\">The inclusive minimum bound</param>\n        /// <param name=\"max\">The exclusive maximum bound.  Must be greater than min</param>\n        public static long NextLong(this Random random, long min, long max)\n        {\n            if (max <= min)\n                throw new ArgumentOutOfRangeException(\"max\", \"max must be > min!\");\n\n            //Working with ulong so that modulo works correctly with values > long.MaxValue\n            ulong uRange = (ulong)(max - min);\n\n            //Prevent a modulo bias; see https://stackoverflow.com/a/10984975/238419\n            //for more information.\n            //In the worst case, the expected number of calls is 2 (though usually it's\n            //much closer to 1) so this loop doesn't really hurt performance at all.\n            ulong ulongRand;\n            do\n            {\n                byte[] buf = new byte[8];\n                random.NextBytes(buf);\n                ulongRand = (ulong)BitConverter.ToInt64(buf, 0);\n            } while (ulongRand > ulong.MaxValue - ((ulong.MaxValue % uRange) + 1) % uRange);\n\n            return (long)(ulongRand % uRange) + min;\n        }\n\n        /// <summary>\n        /// Returns a random long from 0 (inclusive) to max (exclusive)\n        /// </summary>\n        /// <param name=\"random\">The given random instance</param>\n        /// <param name=\"max\">The exclusive maximum bound.  Must be greater than 0</param>\n        public static long NextLong(this Random random, long max)\n        {\n            return random.NextLong(0, max);\n        }\n\n        /// <summary>\n        /// Returns a random long over all possible values of long (except long.MaxValue, similar to\n        /// random.Next())\n        /// </summary>\n        /// <param name=\"random\">The given random instance</param>\n        public static long NextLong(this Random random)\n        {\n            return random.NextLong(long.MinValue, long.MaxValue);\n        }\n    }\n}\n"
  },
  {
    "path": "MongoDbGenericRepository/_rels/.rels",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\n    <Relationship Type=\"http://schemas.microsoft.com/packaging/2010/07/manifest\" Target=\"/MongoDbGenericRepository.nuspec\" Id=\"Rd7ba7aa97a7d4fb2\" />\n    <Relationship Type=\"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\" Target=\"/package/services/metadata/core-properties/e5080d3094a649a39d247315f4dcd1ba.psmdcp\" Id=\"Rcfffb2818c774b93\" />\n</Relationships>"
  },
  {
    "path": "MongoDbGenericRepository.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 17\nVisualStudioVersion = 17.12.35521.163\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"IntegrationTests\", \"IntegrationTests\\IntegrationTests.csproj\", \"{A484A355-A015-40CC-9B35-A4E872421128}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"MongoDbGenericRepository\", \"MongoDbGenericRepository\\MongoDbGenericRepository.csproj\", \"{EFC776C4-2AF3-440C-BE80-3FBE335817A5}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"CoreIntegrationTests\", \"CoreIntegrationTests\\CoreIntegrationTests.csproj\", \"{C640C106-7A25-4E49-A0CF-E4F248E5A97F}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"CoreUnitTests\", \"CoreUnitTests\\CoreUnitTests.csproj\", \"{8BE513ED-84F4-47E1-946D-84958CF95E6B}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{A484A355-A015-40CC-9B35-A4E872421128}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{A484A355-A015-40CC-9B35-A4E872421128}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{A484A355-A015-40CC-9B35-A4E872421128}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{A484A355-A015-40CC-9B35-A4E872421128}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{EFC776C4-2AF3-440C-BE80-3FBE335817A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{EFC776C4-2AF3-440C-BE80-3FBE335817A5}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{EFC776C4-2AF3-440C-BE80-3FBE335817A5}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{EFC776C4-2AF3-440C-BE80-3FBE335817A5}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{C640C106-7A25-4E49-A0CF-E4F248E5A97F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{C640C106-7A25-4E49-A0CF-E4F248E5A97F}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{C640C106-7A25-4E49-A0CF-E4F248E5A97F}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{C640C106-7A25-4E49-A0CF-E4F248E5A97F}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{8BE513ED-84F4-47E1-946D-84958CF95E6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{8BE513ED-84F4-47E1-946D-84958CF95E6B}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{8BE513ED-84F4-47E1-946D-84958CF95E6B}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{8BE513ED-84F4-47E1-946D-84958CF95E6B}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {78214390-EFBD-403C-8AAA-5CD4CA5AE2ED}\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "README.md",
    "content": "# MongoDbGenericRepository\n\nAn example of generic repository implementation using the MongoDB C# Sharp 2.0 (and now 3.*) driver (async)\n\nNow available as a nuget package:\nhttps://www.nuget.org/packages/MongoDbGenericRepository/\n\nCovered by 400+ integration tests and counting.\n\nThe MongoDbGenericRepository is also used in [AspNetCore.Identity.MongoDbCore](https://github.com/alexandre-spieser/AspNetCore.Identity.MongoDbCore).\n\n# Support This Project\n\nIf you have found this project helpful, either as a library that you use or as a learning tool, please consider buying Alex a coffee: <a href=\"https://www.buymeacoffee.com/zeitquest\" target=\"_blank\"><img height=\"40px\" src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" style=\"max-height: 51px;width: 150px !important;\" ></a>\n\n# Worth Knowing\n\nThis package sets the `MongoDefaults.GuidRepresentation` to `MongoDB.Bson.GuidRepresentation.Standard` by default, instead of the default driver setting of `MongoDB.Bson.GuidRepresentation.CSharpLegacy`. This can cause issues if you have been using the driver on an existing application previously or if you are using CosmosDB.\n\nYou can override this behaviour to enforce legacy behaviour in your app Startup routine like so :\n\n`MongoDbContext.SetGuidRepresentation(MongoDB.Bson.GuidRepresentation.CSharpLegacy)`. More info [here](https://github.com/alexandre-spieser/mongodb-generic-repository/issues/7).\n\n# Usage examples\n\nThis repository is meant to be inherited from. \n\nYou are responsible for managing its lifetime, it is advised to setup this repository as a singleton.\n\nHere is an example of repository usage, where the TestRepository is implementing 2 custom methods:\n\n```csharp\n    public interface ITestRepository : IBaseMongoRepository\n    {\n        void DropTestCollection<TDocument>();\n        void DropTestCollection<TDocument>(string partitionKey);\n    }\n    \n    public class TestRepository : BaseMongoRepository, ITestRepository\n    {\n        public TestRepository(string connectionString, string databaseName) : base(connectionString, databaseName)\n        {\n        }\n\n        public void DropTestCollection<TDocument>()\n        {\n            MongoDbContext.DropCollection<TDocument>();\n        }\n\n        public void DropTestCollection<TDocument>(string partitionKey)\n        {\n            MongoDbContext.DropCollection<TDocument>(partitionKey);\n        }\n    }\n```\nIf all your documents have the same type of `Id`, you can use the more specific `BaseMongoRepository<TKey>` where `TKey` is the type of the `Id` of your documents.\n```csharp\n    public class TestTKeyRepository<TKey> : BaseMongoRepository<TKey>, ITestRepository<TKey> where TKey : IEquatable<TKey>\n    {\n        const string connectionString = \"mongodb://localhost:27017/MongoDbTests\";\n        private static readonly ITestRepository<TKey> _instance = new TestTKeyRepository<TKey>(connectionString);\n        /// <inheritdoc />\n        private TestTKeyRepository(string connectionString) : base(connectionString)\n        {\n        }\n    }\n```\n\n## Instantiation\n\nThe repository can be instantiated like so:\n\n```csharp\nITestRepository testRepository = new TestRepository(connectionString, \"MongoDbTests\");\nITestRepository<TKey> testTKeyRepository = new TestTKeyRepository<TKey>(connectionString);\n```\n\nIf you prefer to reuse the same MongoDb database across your application, you can use the `MongoDatabase` from the MongoDb driver implementing the `IMongoDatabase` interface:\n\n```csharp\nvar client = new MongoClient(connectionString);\nvar mongoDbDatabase = Client.GetDatabase(databaseName);\nITestRepository testRepository = new TestRepository(mongoDbDatabase);\n```\n\n## Adding documents\nTo add a document, its class must inherit from the `Document` class,  implement the `IDocument` or `IDocument<TKey>` interface:\n\n```csharp\n    public class MyDocument : Document\n    {\n        public MyDocument()\n        {\n            Version = 2; // you can bump the version of the document schema if you change it over time\n        }\n        public string SomeContent { get; set; }\n    }\n```\n\nThe `IDocument` and `IDocument<TKey>` interfaces can be seen below:\n\n```csharp\n    /// <summary>\n    /// This class represents a basic document that can be stored in MongoDb.\n    /// Your document must implement this class in order for the MongoDbRepository to handle them.\n    /// </summary>\n    public interface IDocument\n    {\n        Guid Id { get; set; }\n        int Version { get; set; }\n    }\n    \n    /// <summary>\n    /// This class represents a basic document that can be stored in MongoDb.\n    /// Your document must implement this class in order for the MongoDbRepository to handle them.\n    /// </summary>\n    public interface IDocument<TKey> where TKey : IEquatable<TKey>\n    {\n        /// <summary>\n        /// The Primary Key, which must be decorated with the [BsonId] attribute \n        /// if you want the MongoDb C# driver to consider it to be the document ID.\n        /// </summary>\n        [BsonId]\n        TKey Id { get; set; }\n        /// <summary>\n        /// A version number, to indicate the version of the schema.\n        /// </summary>\n        int Version { get; set; }\n    }\n```\n\n## Partitioned collections\nThis repository also allows you to partition your document across multiple collections, this can be useful if you are running a SaaS application and want to keep good performance.\n\nTo use partitioned collections, you must define your documents using the PartitionedDocument class, which implements the IPartitionedDocument interface:\n```csharp\n    public class MyPartitionedDocument : PartitionedDocument\n    {\n        public MyPartitionedDocument(string myPartitionKey) : base(myPartitionKey)\n        {\n            Version = 1;\n        }\n        public string SomeContent { get; set; }\n    }\n```\n\nThis partitioned key will be used as a prefix to your collection name.\nThe collection name is derived from the name of the type of your document, is set to camel case, and is pluralized using a class taken from Humanizer (https://github.com/Humanizr/Humanizer).\n\n```csharp\nvar myDoc = new MyPartitionedDocument(\"myPartitionKey\");\n_testRepository.AddOne(myDoc);\n```\n\nThe above code will generate a collection named `myPartitionKey-myPartitionedDocuments`.\n\n## CollectionName Attribute\nIt is now possible to change the collection name by using the `CollectionName` attribute:\n\n```csharp\n    [CollectionName(\"MyCollectionName\")]\n    public class MyDocument : Document\n    {\n        public MyDocument()\n        {\n            Version = 2;\n        }\n        public string SomeContent { get; set; }\n    }\n```\nDocuments of this type will be inserted into a collection named \"MyCollectionName\".\n\n## Index Management\nFrom version 1.3.8 the `MongoDbGenericRepository` implements the `IBaseMongoRepository_Index` and  `IBaseMongoRepository_Index<TKey>` interfaces. \nThis exposes the functionality to programmatically manage indexes against your collections in a generic fashion.\n\nThe following methods are exposed and fully integration tested:\n+ CreateAscendingIndexAsync\n+ CreateDescendingIndexAsync\n+ CreateCombinedTextIndexAsync\n+ CreateHashedIndexAsync\n+ CreateTextIndexAsync\n+ DropIndexAsync\n+ GetIndexesNamesAsync\n\nUsage examples:  \n```csharp\n\tstring expectedIndexName = $\"myCustomIndexName\";\n\tvar option = new IndexCreationOptions\n\t{\n\t\tName = expectedIndexName\n\t};\n\t// Act\n\t// create a text index against the Version property of the document.\n\tvar result = await SUT.CreateTextIndexAsync<T, TKey>(x => x.Version, option, PartitionKey);\n\n\t// Assert\n\tvar listOfIndexNames = await SUT.GetIndexesNamesAsync<T, TKey>(PartitionKey);\n\tAssert.Contains(expectedIndexName, listOfIndexNames);\n\n\t// Cleanup\n\tawait SUT.DropIndexAsync<T, TKey>(expectedIndexName, PartitionKey);\n```\n\nPlease refer to the IntegrationTests (NET45) and CoreIntegrationTests (netstandard2.0) projects for more usage examples.\nThe `CoreIntegrationTests.Infrastructure.MongoDbTKeyDocumentTestBase<T, TKey>` test class is a good start.\n\n## Author\n**Alexandre Spieser**\n\n## License\nmongodb-generic-repository is under MIT license - http://www.opensource.org/licenses/mit-license.php\n\nThe MIT License (MIT)\n\nCopyright (c) 2016-2019 Alexandre Spieser\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n==============================================================================\n\nInflector (https://github.com/srkirkland/Inflector)\nThe MIT License (MIT)\nCopyright (c) 2013 Scott Kirkland\n\n==============================================================================\n\nHumanizer (https://github.com/Humanizr/Humanizer)\nThe MIT License (MIT)\nCopyright (c) 2012-2014 Mehdi Khalili (http://omar.io)\n\n==============================================================================\n\n## Copyright\nCopyright © 2019\n"
  }
]