diff --git a/.vs/MongoDbGenericRepository/v14/.suo b/.vs/MongoDbGenericRepository/v14/.suo
deleted file mode 100644
index 424bfa8..0000000
Binary files a/.vs/MongoDbGenericRepository/v14/.suo and /dev/null differ
diff --git a/.vs/config/applicationhost.config b/.vs/config/applicationhost.config
deleted file mode 100644
index 173fad6..0000000
--- a/.vs/config/applicationhost.config
+++ /dev/null
@@ -1,1038 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CoreIntegrationTests/CoreIntegrationTests.csproj b/CoreIntegrationTests/CoreIntegrationTests.csproj
index 493a082..dbb6dac 100644
--- a/CoreIntegrationTests/CoreIntegrationTests.csproj
+++ b/CoreIntegrationTests/CoreIntegrationTests.csproj
@@ -1,26 +1,23 @@

- netcoreapp2.1
+ net6.0
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers
-
-
-
-
-
-
- ..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Configuration.dll
-
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
diff --git a/CoreIntegrationTests/Infrastructure/BaseMongoDbRepositoryTests.cs b/CoreIntegrationTests/Infrastructure/BaseMongoDbRepositoryTests.cs
index 22b5423..7d00f01 100644
--- a/CoreIntegrationTests/Infrastructure/BaseMongoDbRepositoryTests.cs
+++ b/CoreIntegrationTests/Infrastructure/BaseMongoDbRepositoryTests.cs
@@ -62,18 +62,18 @@ namespace CoreIntegrationTests.Infrastructure
}
#region IDisposable Support
- private bool disposedValue = false; // Pour détecter les appels redondants
+ private bool _disposedValue; // Pour détecter les appels redondants
protected virtual void Dispose(bool disposing)
{
- if (!disposedValue)
+ if (!_disposedValue)
{
if (disposing)
{
Cleanup();
}
- disposedValue = true;
+ _disposedValue = true;
}
}
diff --git a/CoreIntegrationTests/Infrastructure/MongoDbConfig.cs b/CoreIntegrationTests/Infrastructure/MongoDbConfig.cs
index eb87022..c41302a 100644
--- a/CoreIntegrationTests/Infrastructure/MongoDbConfig.cs
+++ b/CoreIntegrationTests/Infrastructure/MongoDbConfig.cs
@@ -5,8 +5,8 @@ namespace CoreIntegrationTests.Infrastructure
{
internal static class MongoDbConfig
{
- private static bool _initialized = false;
- private static object _initializationLock = new object();
+ private static bool _initialized;
+ private static object _initializationLock = new();
private static object _initializationTarget;
public static void EnsureConfigured()
diff --git a/CoreIntegrationTests/Infrastructure/MongoDbDocumentTestBase.Main.cs b/CoreIntegrationTests/Infrastructure/MongoDbDocumentTestBase.Main.cs
index 98fc846..893908c 100644
--- a/CoreIntegrationTests/Infrastructure/MongoDbDocumentTestBase.Main.cs
+++ b/CoreIntegrationTests/Infrastructure/MongoDbDocumentTestBase.Main.cs
@@ -1,6 +1,4 @@
-using MongoDbGenericRepository;
-using MongoDbGenericRepository.Models;
-using System;
+using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
@@ -8,12 +6,12 @@ using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
+using MongoDbGenericRepository.Models;
using Xunit;
namespace CoreIntegrationTests.Infrastructure
{
- public abstract partial class MongoDbDocumentTestBase :
- IClassFixture>
+ public abstract partial class MongoDbDocumentTestBase
where T : TestDoc, new()
{
@@ -74,7 +72,7 @@ namespace CoreIntegrationTests.Infrastructure
// Arrange
var document = CreateTestDocument();
// Act
- SUT.AddOne(document);
+ SUT.AddOne(document);
// Assert
long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count(e => e.Id.Equals(document.Id))
: SUT.Count(e => e.Id.Equals(document.Id), PartitionKey);
@@ -87,7 +85,7 @@ namespace CoreIntegrationTests.Infrastructure
// Arrange
var document = CreateTestDocument();
// Act
- await SUT.AddOneAsync(document);
+ await SUT.AddOneAsync(document);
// Assert
long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count(e => e.Id.Equals(document.Id))
: SUT.Count(e => e.Id.Equals(document.Id), PartitionKey);
@@ -100,7 +98,7 @@ namespace CoreIntegrationTests.Infrastructure
// Arrange
var documents = CreateTestDocuments(2);
// Act
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
// Assert
long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count(e => e.Id.Equals(documents[0].Id)
|| e.Id.Equals(documents[1].Id))
@@ -123,7 +121,7 @@ namespace CoreIntegrationTests.Infrastructure
((IPartitionedDocument)documents[2]).PartitionKey = secondPartitionKey;
((IPartitionedDocument)documents[3]).PartitionKey = secondPartitionKey;
// Act
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
// Assert
long count = SUT.Count(e => e.Id.Equals(documents[0].Id) || e.Id.Equals(documents[1].Id), PartitionKey);
long secondPartitionCount = SUT.Count(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);
@@ -141,7 +139,7 @@ namespace CoreIntegrationTests.Infrastructure
// Arrange
var documents = CreateTestDocuments(2);
// Act
- await SUT.AddManyAsync(documents);
+ await SUT.AddManyAsync(documents);
// Assert
long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count(e => e.Id.Equals(documents[0].Id)
|| e.Id.Equals(documents[1].Id))
@@ -164,7 +162,7 @@ namespace CoreIntegrationTests.Infrastructure
((IPartitionedDocument)documents[2]).PartitionKey = secondPartitionKey;
((IPartitionedDocument)documents[3]).PartitionKey = secondPartitionKey;
// Act
- await SUT.AddManyAsync(documents);
+ await SUT.AddManyAsync(documents);
// Assert
long count = SUT.Count(e => e.Id.Equals(documents[0].Id) || e.Id.Equals(documents[1].Id), PartitionKey);
long secondPartitionCount = SUT.Count(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);
@@ -185,7 +183,7 @@ namespace CoreIntegrationTests.Infrastructure
{
// Arrange
var document = CreateTestDocument();
- SUT.AddOne(document);
+ await SUT.AddOneAsync(document);
// Act
var result = await SUT.GetByIdAsync(document.Id, PartitionKey);
// Assert
@@ -197,7 +195,7 @@ namespace CoreIntegrationTests.Infrastructure
{
// Arrange
var document = CreateTestDocument();
- SUT.AddOne(document);
+ SUT.AddOne(document);
// Act
var result = SUT.GetById(document.Id, PartitionKey);
// Assert
@@ -209,7 +207,7 @@ namespace CoreIntegrationTests.Infrastructure
{
// Arrange
var document = CreateTestDocument();
- SUT.AddOne(document);
+ SUT.AddOne(document);
// Act
var result = await SUT.GetOneAsync(x => x.Id.Equals(document.Id), PartitionKey);
// Assert
@@ -221,7 +219,7 @@ namespace CoreIntegrationTests.Infrastructure
{
// Arrange
var document = CreateTestDocument();
- SUT.AddOne(document);
+ SUT.AddOne(document);
// Act
var result = SUT.GetOne(x => x.Id.Equals(document.Id), PartitionKey);
// Assert
@@ -233,7 +231,7 @@ namespace CoreIntegrationTests.Infrastructure
{
// Arrange
var document = CreateTestDocument();
- SUT.AddOne(document);
+ SUT.AddOne(document);
// Act
var cursor = SUT.GetCursor(x => x.Id.Equals(document.Id), PartitionKey);
var count = cursor.CountDocuments();
@@ -246,7 +244,7 @@ namespace CoreIntegrationTests.Infrastructure
{
// Arrange
var document = CreateTestDocument();
- SUT.AddOne(document);
+ SUT.AddOne(document);
// Act
var result = await SUT.AnyAsync(x => x.Id.Equals(document.Id), PartitionKey);
// Assert
@@ -258,7 +256,7 @@ namespace CoreIntegrationTests.Infrastructure
{
// Arrange
var document = CreateTestDocument();
- SUT.AddOne(document);
+ SUT.AddOne(document);
// Act
var result = await SUT.AnyAsync(x => x.Id.Equals(Guid.NewGuid()), PartitionKey);
// Assert
@@ -270,7 +268,7 @@ namespace CoreIntegrationTests.Infrastructure
{
// Arrange
var document = CreateTestDocument();
- SUT.AddOne(document);
+ SUT.AddOne(document);
// Act
var result = SUT.Any(x => x.Id.Equals(document.Id), PartitionKey);
// Assert
@@ -282,7 +280,7 @@ namespace CoreIntegrationTests.Infrastructure
{
// Arrange
var document = CreateTestDocument();
- SUT.AddOne(document);
+ SUT.AddOne(document);
// Act
var result = SUT.Any(x => x.Id.Equals(Guid.NewGuid()), PartitionKey);
// Assert
@@ -296,7 +294,7 @@ namespace CoreIntegrationTests.Infrastructure
var documents = CreateTestDocuments(5);
var content = GetContent();
documents.ForEach(e => e.SomeContent = content);
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
// Act
var result = await SUT.GetAllAsync(x => x.SomeContent == content, PartitionKey);
// Assert
@@ -310,7 +308,7 @@ namespace CoreIntegrationTests.Infrastructure
var documents = CreateTestDocuments(5);
var content = GetContent();
documents.ForEach(e => e.SomeContent = content);
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
// Act
var result = SUT.GetAll(x => x.SomeContent == content, PartitionKey);
// Assert
@@ -324,7 +322,7 @@ namespace CoreIntegrationTests.Infrastructure
var documents = CreateTestDocuments(5);
var content = GetContent();
documents.ForEach(e => e.SomeContent = content);
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
// Act
var result = await SUT.CountAsync(x => x.SomeContent == content, PartitionKey);
// Assert
@@ -338,7 +336,7 @@ namespace CoreIntegrationTests.Infrastructure
var documents = CreateTestDocuments(5);
var content = GetContent();
documents.ForEach(e => e.SomeContent = content);
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
// Act
var result = SUT.Count(x => x.SomeContent == content, PartitionKey);
// Assert
@@ -354,9 +352,9 @@ namespace CoreIntegrationTests.Infrastructure
{
// Arrange
var document = CreateTestDocument();
- SUT.AddOne(document);
+ SUT.AddOne(document);
// Act
- var result = SUT.DeleteOne(document);
+ var result = SUT.DeleteOne(document);
// Assert
Assert.True(1 == result);
Assert.False(SUT.Any(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
@@ -367,7 +365,7 @@ namespace CoreIntegrationTests.Infrastructure
{
// Arrange
var document = CreateTestDocument();
- SUT.AddOne(document);
+ SUT.AddOne(document);
// Act
var result = SUT.DeleteOne(e => e.Id.Equals(document.Id), PartitionKey);
// Assert
@@ -380,9 +378,9 @@ namespace CoreIntegrationTests.Infrastructure
{
// Arrange
var document = CreateTestDocument();
- SUT.AddOne(document);
+ SUT.AddOne(document);
// Act
- var result = await SUT.DeleteOneAsync(document);
+ var result = await SUT.DeleteOneAsync(document);
// Assert
Assert.True(1 == result);
Assert.False(SUT.Any(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
@@ -393,7 +391,7 @@ namespace CoreIntegrationTests.Infrastructure
{
// Arrange
var document = CreateTestDocument();
- SUT.AddOne(document);
+ SUT.AddOne(document);
// Act
var result = await SUT.DeleteOneAsync(e => e.Id.Equals(document.Id), PartitionKey);
// Assert
@@ -408,7 +406,7 @@ namespace CoreIntegrationTests.Infrastructure
var criteria = $"{GetTestName()}.{DocumentTypeName}";
var documents = CreateTestDocuments(5);
documents.ForEach(e => e.SomeContent = criteria);
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
// Act
var result = await SUT.DeleteManyAsync(e => e.SomeContent == criteria, PartitionKey);
// Assert
@@ -432,9 +430,9 @@ namespace CoreIntegrationTests.Infrastructure
((IPartitionedDocument)documents[4]).PartitionKey = secondKey;
}
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
// Act
- var result = await SUT.DeleteManyAsync(documents);
+ var result = await SUT.DeleteManyAsync(documents);
// Assert
Assert.True(5 == result);
Assert.False(SUT.Any(e => e.SomeContent == criteria, PartitionKey), GetTestName());
@@ -451,7 +449,7 @@ namespace CoreIntegrationTests.Infrastructure
var criteria = $"{GetTestName()}.{DocumentTypeName}";
var documents = CreateTestDocuments(5);
documents.ForEach(e => e.SomeContent = criteria);
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
// Act
var result = SUT.DeleteMany(e => e.SomeContent == criteria, PartitionKey);
// Assert
@@ -475,9 +473,9 @@ namespace CoreIntegrationTests.Infrastructure
((IPartitionedDocument)documents[4]).PartitionKey = secondKey;
}
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
// Act
- var result = SUT.DeleteMany(documents);
+ var result = SUT.DeleteMany(documents);
// Assert
Assert.True(5 == result);
Assert.False(SUT.Any(e => e.SomeContent == criteria, PartitionKey), GetTestName());
@@ -500,7 +498,7 @@ namespace CoreIntegrationTests.Infrastructure
var document = CreateTestDocument();
document.SomeContent = someContent;
document.Nested.SomeDate = someDate;
- SUT.AddOne(document);
+ SUT.AddOne(document);
// Act
var result = await SUT.ProjectOneAsync(
x => x.Id.Equals(document.Id),
@@ -526,7 +524,7 @@ namespace CoreIntegrationTests.Infrastructure
var document = CreateTestDocument();
document.SomeContent = someContent;
document.Nested.SomeDate = someDate;
- SUT.AddOne(document);
+ SUT.AddOne(document);
// Act
var result = SUT.ProjectOne(
x => x.Id.Equals(document.Id),
@@ -556,7 +554,7 @@ namespace CoreIntegrationTests.Infrastructure
e.Nested.SomeDate = someDate;
});
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
// Act
var result = await SUT.ProjectManyAsync(
x => x.SomeContent == someContent,
@@ -586,7 +584,7 @@ namespace CoreIntegrationTests.Infrastructure
e.Nested.SomeDate = someDate;
});
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
// Act
var result = SUT.ProjectMany(
x => x.SomeContent == someContent,
@@ -619,7 +617,7 @@ namespace CoreIntegrationTests.Infrastructure
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();
// Act
@@ -642,7 +640,7 @@ namespace CoreIntegrationTests.Infrastructure
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();
// Act
@@ -665,7 +663,7 @@ namespace CoreIntegrationTests.Infrastructure
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();
// Act
@@ -688,7 +686,7 @@ namespace CoreIntegrationTests.Infrastructure
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();
// Act
@@ -711,7 +709,7 @@ namespace CoreIntegrationTests.Infrastructure
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();
// Act
@@ -734,7 +732,7 @@ namespace CoreIntegrationTests.Infrastructure
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();
// Act
@@ -757,7 +755,7 @@ namespace CoreIntegrationTests.Infrastructure
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();
// Act
@@ -780,7 +778,7 @@ namespace CoreIntegrationTests.Infrastructure
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
var expectedMin = documents.OrderByDescending(e => e.Nested.SomeDate).First();
// Act
@@ -910,7 +908,7 @@ namespace CoreIntegrationTests.Infrastructure
// Act
Expression > ex = x => x.SomeContent2;
Expression > ex2 = x => x.SomeContent3;
- var result = await SUT.CreateCombinedTextIndexAsync(new[] { ex, ex2 }, null, PartitionKey);
+ var result = await SUT.CreateCombinedTextIndexAsync(new[] { ex, ex2 }, null, PartitionKey);
// Assert
var listOfIndexNames = await SUT.GetIndexesNamesAsync(PartitionKey);
@@ -937,7 +935,7 @@ namespace CoreIntegrationTests.Infrastructure
e.Nested.SomeAmount = 5m;
e.SomeContent = criteria;
});
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
var expectedSum = documents.Sum(e => e.Nested.SomeAmount);
// Act
@@ -960,7 +958,7 @@ namespace CoreIntegrationTests.Infrastructure
e.Nested.SomeAmount = 5m;
e.SomeContent = criteria;
});
- SUT.AddMany(documents);
+ SUT.AddMany(documents);
var expectedSum = documents.Sum(e => e.Nested.SomeAmount);
// Act
diff --git a/CoreUnitTests/.editorconfig b/CoreUnitTests/.editorconfig
new file mode 100644
index 0000000..4db872d
--- /dev/null
+++ b/CoreUnitTests/.editorconfig
@@ -0,0 +1,218 @@
+# All Files
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 4
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+#########################################
+# File Extension Settings
+##########################################
+
+# .NET Style Rules
+# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#net-style-rules
+[*.cs]
+# "this." and "Me." qualifiers
+dotnet_style_qualification_for_field = false:warning
+dotnet_style_qualification_for_property = false:warning
+dotnet_style_qualification_for_method = false:warning
+dotnet_style_qualification_for_event = false:warning
+# Language keywords instead of framework type names for type references
+dotnet_style_predefined_type_for_locals_parameters_members = true:warning
+dotnet_style_predefined_type_for_member_access = true:warning
+# Modifier preferences
+dotnet_style_require_accessibility_modifiers = always:warning
+csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning
+visual_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
+dotnet_style_readonly_field = true:warning
+# Parentheses preferences
+dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning
+dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning
+dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning
+dotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning
+# Expression-level preferences
+dotnet_style_object_initializer = true:warning
+dotnet_style_collection_initializer = true:warning
+dotnet_style_explicit_tuple_names = true:warning
+dotnet_style_prefer_inferred_tuple_names = true:warning
+dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
+dotnet_style_prefer_auto_properties = true:warning
+dotnet_style_prefer_conditional_expression_over_assignment = false:suggestion
+dotnet_diagnostic.IDE0045.severity = suggestion
+dotnet_style_prefer_conditional_expression_over_return = false:suggestion
+dotnet_diagnostic.IDE0046.severity = suggestion
+dotnet_style_prefer_compound_assignment = true:warning
+dotnet_style_prefer_simplified_interpolation = true:warning
+dotnet_style_prefer_simplified_boolean_expressions = true:warning
+# Null-checking preferences
+dotnet_style_coalesce_expression = true:warning
+dotnet_style_null_propagation = true:warning
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
+# File header preferences
+# file_header_template = \n© PROJECT-AUTHOR\n
+# If you use StyleCop, you'll need to disable SA1636: File header copyright text should match.
+# dotnet_diagnostic.SA1636.severity = none
+# Undocumented
+dotnet_style_operator_placement_when_wrapping = end_of_line:warning
+csharp_style_prefer_null_check_over_type_check = true:warning
+dotnet_analyzer_diagnostic.severity = warning
+dotnet_code_quality_unused_parameters = all:warning
+dotnet_remove_unnecessary_suppression_exclusions = none:warning
+dotnet_sort_system_directives_first = true
+dotnet_separate_import_directive_groups = false
+dotnet_style_namespace_match_folder = true:suggestion
+dotnet_diagnostic.IDE0130.severity = suggestion
+dotnet_naming_style.camel_case_style.capitalization = camel_case
+dotnet_naming_style.pascal_case_style.capitalization = pascal_case
+dotnet_naming_style.first_upper_style.capitalization = first_word_upper
+dotnet_naming_style.prefix_interface_with_i_style.capitalization = pascal_case
+dotnet_naming_style.prefix_interface_with_i_style.required_prefix = I
+dotnet_naming_style.prefix_type_parameters_with_t_style.capitalization = pascal_case
+dotnet_naming_style.prefix_type_parameters_with_t_style.required_prefix = T
+dotnet_naming_style.disallowed_style.capitalization = pascal_case
+dotnet_naming_style.disallowed_style.required_prefix = ____RULE_VIOLATION____
+dotnet_naming_style.disallowed_style.required_suffix = ____RULE_VIOLATION____
+dotnet_naming_style.internal_error_style.capitalization = pascal_case
+dotnet_naming_style.internal_error_style.required_prefix = ____INTERNAL_ERROR____
+dotnet_naming_style.internal_error_style.required_suffix = ____INTERNAL_ERROR____
+dotnet_naming_symbols.public_protected_constant_fields_group.applicable_accessibilities = public, protected, protected_internal
+dotnet_naming_symbols.public_protected_constant_fields_group.required_modifiers = const
+dotnet_naming_symbols.public_protected_constant_fields_group.applicable_kinds = field
+dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.symbols = public_protected_constant_fields_group
+dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.style = pascal_case_style
+dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.severity = warning
+dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_accessibilities = public, protected, protected_internal
+dotnet_naming_symbols.public_protected_static_readonly_fields_group.required_modifiers = static, readonly
+dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_kinds = field
+dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.symbols = public_protected_static_readonly_fields_group
+dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.style = pascal_case_style
+dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.severity = warning
+dotnet_naming_symbols.other_public_protected_fields_group.applicable_accessibilities = public, protected, protected_internal
+dotnet_naming_symbols.other_public_protected_fields_group.applicable_kinds = field
+dotnet_naming_rule.other_public_protected_fields_disallowed_rule.symbols = other_public_protected_fields_group
+dotnet_naming_rule.other_public_protected_fields_disallowed_rule.style = disallowed_style
+dotnet_naming_rule.other_public_protected_fields_disallowed_rule.severity = error
+dotnet_naming_symbols.stylecop_constant_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private
+dotnet_naming_symbols.stylecop_constant_fields_group.required_modifiers = const
+dotnet_naming_symbols.stylecop_constant_fields_group.applicable_kinds = field
+dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.symbols = stylecop_constant_fields_group
+dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.style = pascal_case_style
+dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.severity = warning
+dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private
+dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static, readonly
+dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_kinds = field
+dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.symbols = stylecop_static_readonly_fields_group
+dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.style = pascal_case_style
+dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.severity = warning
+dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected
+dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_kinds = field
+dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.symbols = stylecop_fields_must_be_private_group
+dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.style = disallowed_style
+dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.severity = error
+dotnet_naming_symbols.stylecop_private_fields_group.applicable_accessibilities = private
+dotnet_naming_symbols.stylecop_private_fields_group.applicable_kinds = field
+dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.symbols = stylecop_private_fields_group
+dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.style = camel_case_style
+dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.severity = warning
+dotnet_naming_symbols.stylecop_local_fields_group.applicable_accessibilities = local
+dotnet_naming_symbols.stylecop_local_fields_group.applicable_kinds = local
+dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.symbols = stylecop_local_fields_group
+dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.style = camel_case_style
+dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.severity = silent
+dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_accessibilities = *
+dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_kinds = field
+dotnet_naming_rule.sanity_check_uncovered_field_case_rule.symbols = sanity_check_uncovered_field_case_group
+dotnet_naming_rule.sanity_check_uncovered_field_case_rule.style = internal_error_style
+dotnet_naming_rule.sanity_check_uncovered_field_case_rule.severity = error
+dotnet_naming_symbols.element_group.applicable_kinds = namespace, class, enum, struct, delegate, event, method, property
+dotnet_naming_rule.element_rule.symbols = element_group
+dotnet_naming_rule.element_rule.style = pascal_case_style
+dotnet_naming_rule.element_rule.severity = warning
+dotnet_naming_symbols.interface_group.applicable_kinds = interface
+dotnet_naming_rule.interface_rule.symbols = interface_group
+dotnet_naming_rule.interface_rule.style = prefix_interface_with_i_style
+dotnet_naming_rule.interface_rule.severity = warning
+dotnet_naming_symbols.type_parameter_group.applicable_kinds = type_parameter
+dotnet_naming_rule.type_parameter_rule.symbols = type_parameter_group
+dotnet_naming_rule.type_parameter_rule.style = prefix_type_parameters_with_t_style
+dotnet_naming_rule.type_parameter_rule.severity = warning
+dotnet_naming_symbols.parameters_group.applicable_kinds = parameter
+dotnet_naming_rule.parameters_rule.symbols = parameters_group
+dotnet_naming_rule.parameters_rule.style = camel_case_style
+dotnet_naming_rule.parameters_rule.severity = warning
+csharp_style_var_for_built_in_types = true:warning
+csharp_style_var_when_type_is_apparent = true:warning
+csharp_style_var_elsewhere = true:warning
+csharp_style_expression_bodied_methods = true:warning
+csharp_style_expression_bodied_constructors = true:warning
+csharp_style_expression_bodied_operators = true:warning
+csharp_style_expression_bodied_properties = true:warning
+csharp_style_expression_bodied_indexers = true:warning
+csharp_style_expression_bodied_accessors = true:warning
+csharp_style_expression_bodied_lambdas = true:warning
+csharp_style_expression_bodied_local_functions = true:warning
+csharp_style_pattern_matching_over_is_with_cast_check = true:warning
+csharp_style_pattern_matching_over_as_with_null_check = true:warning
+csharp_style_prefer_switch_expression = true:warning
+csharp_style_prefer_pattern_matching = true:warning
+csharp_style_prefer_not_pattern = true:warning
+csharp_style_inlined_variable_declaration = true:warning
+csharp_prefer_simple_default_expression = true:warning
+csharp_style_pattern_local_over_anonymous_function = true:warning
+csharp_style_deconstructed_variable_declaration = true:warning
+csharp_style_prefer_index_operator = true:warning
+csharp_style_prefer_range_operator = true:warning
+csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
+csharp_style_throw_expression = true:warning
+csharp_style_conditional_delegate_call = true:warning
+csharp_prefer_braces = true:warning
+csharp_prefer_simple_using_statement = true:suggestion
+dotnet_diagnostic.IDE0063.severity = suggestion
+csharp_using_directive_placement = outside_namespace
+csharp_prefer_static_local_function = true:warning
+csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
+dotnet_diagnostic.IDE0058.severity = suggestion
+csharp_style_unused_value_assignment_preference = discard_variable:suggestion
+dotnet_diagnostic.IDE0059.severity = suggestion
+csharp_new_line_before_open_brace = all
+csharp_new_line_before_else = true
+csharp_new_line_before_catch = true
+csharp_new_line_before_finally = true
+csharp_new_line_before_members_in_object_initializers = true
+csharp_new_line_before_members_in_anonymous_types = true
+csharp_new_line_between_query_expression_clauses = true
+csharp_indent_case_contents = true
+csharp_indent_switch_labels = true
+csharp_indent_labels = no_change
+csharp_indent_block_contents = true
+csharp_indent_braces = false
+csharp_indent_case_contents_when_block = false
+csharp_space_after_cast = false
+csharp_space_after_keywords_in_control_flow_statements = true
+csharp_space_between_parentheses = false
+csharp_space_before_colon_in_inheritance_clause = true
+csharp_space_after_colon_in_inheritance_clause = true
+csharp_space_around_binary_operators = before_and_after
+csharp_space_between_method_declaration_parameter_list_parentheses = false
+csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
+csharp_space_between_method_declaration_name_and_open_parenthesis = false
+csharp_space_between_method_call_parameter_list_parentheses = false
+csharp_space_between_method_call_empty_parameter_list_parentheses = false
+csharp_space_between_method_call_name_and_opening_parenthesis = false
+csharp_space_after_comma = true
+csharp_space_before_comma = false
+csharp_space_after_dot = false
+csharp_space_before_dot = false
+csharp_space_after_semicolon_in_for_statement = true
+csharp_space_before_semicolon_in_for_statement = false
+csharp_space_around_declaration_statements = false
+csharp_space_before_open_square_brackets = false
+csharp_space_between_empty_square_brackets = false
+csharp_space_between_square_brackets = false
+csharp_preserve_single_line_statements = false
+csharp_preserve_single_line_blocks = true
+csharp_style_namespace_declarations = file_scoped:warning
+dotnet_diagnostic.CA1707.severity = none
+
+
diff --git a/CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddManyAsyncTests.cs b/CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddManyAsyncTests.cs
new file mode 100644
index 0000000..2de822e
--- /dev/null
+++ b/CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddManyAsyncTests.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using AutoFixture;
+using CoreUnitTests.Infrastructure;
+using CoreUnitTests.Infrastructure.Model;
+using MongoDbGenericRepository.DataAccess.Create;
+using Moq;
+using Xunit;
+
+namespace CoreUnitTests.BaseMongoRepositoryTests.AddTests;
+
+public class AddManyAsyncTests : TestMongoRepositoryContext
+{
+ [Fact]
+ public async Task WithDocument_ShouldAddOne()
+ {
+ // Arrange
+ var documents = Fixture.CreateMany().ToList();
+ Creator = new Mock();
+
+ // Act
+ await Sut.AddManyAsync(documents);
+
+ // Assert
+ Creator.Verify(x => x.AddManyAsync(documents, CancellationToken.None), Times.Once);
+ }
+
+ [Fact]
+ public async Task WithDocumentAndCancellationToken_ShouldAddOne()
+ {
+ // Arrange
+ var documents = Fixture.CreateMany().ToList();
+ var token = new CancellationToken(true);
+ Creator = new Mock();
+
+ // Act
+ await Sut.AddManyAsync(documents, token);
+
+ // Assert
+ Creator.Verify(x => x.AddManyAsync(documents, token), Times.Once);
+ }
+
+ #region Keyed
+
+ [Fact]
+ public async Task Keyed_WithDocument_ShouldAddOne()
+ {
+ // Arrange
+ var documents = Fixture.CreateMany>().ToList();
+ Creator = new Mock();
+
+ // Act
+ await Sut.AddManyAsync, int>(documents);
+
+ // Assert
+ Creator.Verify(x => x.AddManyAsync, int>(documents, CancellationToken.None), Times.Once);
+ }
+
+ [Fact]
+ public async Task Keyed_WithDocumentAndCancellationToken_ShouldAddOne()
+ {
+ // Arrange
+ var documents = Fixture.CreateMany>().ToList();
+ var token = new CancellationToken(true);
+ Creator = new Mock();
+
+ // Act
+ await Sut.AddManyAsync, int>(documents, token);
+
+ // Assert
+ Creator.Verify(x => x.AddManyAsync, int>(documents, token), Times.Once);
+ }
+
+ #endregion
+}
diff --git a/CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddManyTests.cs b/CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddManyTests.cs
new file mode 100644
index 0000000..1fb839a
--- /dev/null
+++ b/CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddManyTests.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Linq;
+using System.Threading;
+using AutoFixture;
+using CoreUnitTests.Infrastructure;
+using CoreUnitTests.Infrastructure.Model;
+using MongoDbGenericRepository.DataAccess.Create;
+using Moq;
+using Xunit;
+
+namespace CoreUnitTests.BaseMongoRepositoryTests.AddTests;
+
+public class AddManyTests : TestMongoRepositoryContext
+{
+
+ [Fact]
+ public void WithDocument_ShouldAddOne()
+ {
+ // Arrange
+ var documents = Fixture.CreateMany().ToList();
+ Creator = new Mock();
+
+ // Act
+ Sut.AddMany(documents);
+
+ // Assert
+ Creator.Verify(x => x.AddMany(documents, CancellationToken.None), Times.Once);
+ }
+
+ [Fact]
+ public void WithDocumentAndCancellationToken_ShouldAddOne()
+ {
+ // Arrange
+ var documents = Fixture.CreateMany().ToList();
+ var token = new CancellationToken(true);
+ Creator = new Mock();
+
+ // Act
+ Sut.AddMany(documents, token);
+
+ // Assert
+ Creator.Verify(x => x.AddMany(documents, token), Times.Once);
+ }
+
+ #region Keyed
+
+ [Fact]
+ public void Keyed_WithDocument_ShouldAddOne()
+ {
+ // Arrange
+ var documents = Fixture.CreateMany>().ToList();
+ Creator = new Mock();
+
+ // Act
+ Sut.AddMany, int>(documents);
+
+ // Assert
+ Creator.Verify(x => x.AddMany, int>(documents, CancellationToken.None), Times.Once);
+ }
+
+ [Fact]
+ public void Keyed_WithDocumentAndCancellationToken_ShouldAddOne()
+ {
+ // Arrange
+ var documents = Fixture.CreateMany>().ToList();
+ var token = new CancellationToken(true);
+ Creator = new Mock();
+
+ // Act
+ Sut.AddMany, int>(documents, token);
+
+ // Assert
+ Creator.Verify(x => x.AddMany, int>(documents, token), Times.Once);
+ }
+
+ #endregion
+}
diff --git a/CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddOneAsyncTests.cs b/CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddOneAsyncTests.cs
new file mode 100644
index 0000000..92deacb
--- /dev/null
+++ b/CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddOneAsyncTests.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using AutoFixture;
+using CoreUnitTests.Infrastructure;
+using CoreUnitTests.Infrastructure.Model;
+using MongoDbGenericRepository.DataAccess.Create;
+using Moq;
+using Xunit;
+
+namespace CoreUnitTests.BaseMongoRepositoryTests.AddTests;
+
+public class AddOneAsyncTests : TestMongoRepositoryContext
+{
+ [Fact]
+ public async Task WithDocument_ShouldAddOne()
+ {
+ // Arrange
+ var document = Fixture.Create();
+ Creator = new Mock();
+
+ // Act
+ await Sut.AddOneAsync(document);
+
+ // Assert
+ Creator.Verify(x => x.AddOneAsync(document, CancellationToken.None), Times.Once);
+ }
+
+ [Fact]
+ public async Task WithDocumentAndCancellationToken_ShouldAddOne()
+ {
+ // Arrange
+ var document = Fixture.Create();
+ var token = new CancellationToken(true);
+ Creator = new Mock();
+
+ // Act
+ await Sut.AddOneAsync(document, token);
+
+ // Assert
+ Creator.Verify(x => x.AddOneAsync(document, token), Times.Once);
+ }
+
+ #region Keyed
+
+ [Fact]
+ public async Task Keyed_WithDocument_ShouldAddOne()
+ {
+ // Arrange
+ var document = Fixture.Create>();
+ Creator = new Mock();
+
+ // Act
+ await Sut.AddOneAsync, int>(document);
+
+ // Assert
+ Creator.Verify(x => x.AddOneAsync, int>(document, CancellationToken.None), Times.Once);
+ }
+
+ [Fact]
+ public async Task Keyed_WithDocumentAndCancellationToken_ShouldAddOne()
+ {
+ // Arrange
+ var document = Fixture.Create>();
+ var token = new CancellationToken(true);
+ Creator = new Mock();
+
+ // Act
+ await Sut.AddOneAsync, int>(document, token);
+
+ // Assert
+ Creator.Verify(x => x.AddOneAsync, int>(document, token), Times.Once);
+ }
+
+ #endregion
+}
diff --git a/CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddOneTests.cs b/CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddOneTests.cs
new file mode 100644
index 0000000..f3b419c
--- /dev/null
+++ b/CoreUnitTests/BaseMongoRepositoryTests/AddTests/AddOneTests.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Threading;
+using AutoFixture;
+using CoreUnitTests.Infrastructure;
+using CoreUnitTests.Infrastructure.Model;
+using MongoDbGenericRepository.DataAccess.Create;
+using Moq;
+using Xunit;
+
+namespace CoreUnitTests.BaseMongoRepositoryTests.AddTests;
+
+public class AddOneTests : TestMongoRepositoryContext
+{
+ [Fact]
+ public void WithDocument_ShouldAddOne()
+ {
+ // Arrange
+ var document = Fixture.Create();
+ Creator = new Mock();
+
+ // Act
+ Sut.AddOne(document);
+
+ // Assert
+ Creator.Verify(x => x.AddOne(document, CancellationToken.None), Times.Once);
+ }
+
+ [Fact]
+ public void WithDocumentAndCancellationToken_ShouldAddOne()
+ {
+ // Arrange
+ var document = Fixture.Create();
+ var token = new CancellationToken(true);
+ Creator = new Mock();
+
+ // Act
+ Sut.AddOne(document, token);
+
+ // Assert
+ Creator.Verify(x => x.AddOne(document, token), Times.Once);
+ }
+
+ #region Keyed
+
+ [Fact]
+ public void Keyed_WithDocument_ShouldAddOne()
+ {
+ // Arrange
+ var document = Fixture.Create>();
+ Creator = new Mock();
+
+ // Act
+ Sut.AddOne, int>(document);
+
+ // Assert
+ Creator.Verify(x => x.AddOne, int>(document, CancellationToken.None), Times.Once);
+ }
+
+ [Fact]
+ public void Keyed_WithDocumentAndCancellationToken_ShouldAddOne()
+ {
+ // Arrange
+ var document = Fixture.Create>();
+ var token = new CancellationToken(true);
+ Creator = new Mock();
+
+ // Act
+ Sut.AddOne, int>(document, token);
+
+ // Assert
+ Creator.Verify(x => x.AddOne, int>(document, token), Times.Once);
+ }
+
+ #endregion
+}
diff --git a/CoreUnitTests/BaseMongoRepositoryTests/DeleteTests/DeleteManyAsyncTests.cs b/CoreUnitTests/BaseMongoRepositoryTests/DeleteTests/DeleteManyAsyncTests.cs
new file mode 100644
index 0000000..07bad84
--- /dev/null
+++ b/CoreUnitTests/BaseMongoRepositoryTests/DeleteTests/DeleteManyAsyncTests.cs
@@ -0,0 +1,320 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Threading;
+using System.Threading.Tasks;
+using AutoFixture;
+using CoreUnitTests.Infrastructure;
+using CoreUnitTests.Infrastructure.Model;
+using FluentAssertions;
+using MongoDbGenericRepository.DataAccess.Delete;
+using Moq;
+using Xunit;
+
+namespace CoreUnitTests.BaseMongoRepositoryTests.DeleteTests;
+
+public class DeleteManyAsyncTests : TestMongoRepositoryContext
+{
+ [Fact]
+ public async Task WithDocuments_ShouldDeleteMany()
+ {
+ // Arrange
+ var documents = Fixture.CreateMany().ToList();
+ var count = Fixture.Create();
+ Eraser = new Mock();
+
+ Eraser
+ .Setup(x => x.DeleteManyAsync(It.IsAny>(), It.IsAny()))
+ .ReturnsAsync(count);
+
+ // Act
+ var result = await Sut.DeleteManyAsync(documents);
+
+ // Assert
+ result.Should().Be(count);
+ Eraser.Verify(x => x.DeleteManyAsync(documents, CancellationToken.None), Times.Once);
+ }
+
+ [Fact]
+ public async Task WithDocumentsAndCancellationToken_ShouldDeleteMany()
+ {
+ // Arrange
+ var documents = Fixture.CreateMany().ToList();
+ var count = Fixture.Create();
+ var cancellationToken = new CancellationToken(true);
+ Eraser = new Mock();
+
+ Eraser
+ .Setup(x => x.DeleteManyAsync(It.IsAny>(), It.IsAny()))
+ .ReturnsAsync(count);
+
+ // Act
+ var result = await Sut.DeleteManyAsync(documents, cancellationToken);
+
+ // Assert
+ result.Should().Be(count);
+ Eraser.Verify(x => x.DeleteManyAsync(documents, cancellationToken), Times.Once);
+ }
+
+ [Fact]
+ public async Task WithFilter_ShouldDeleteMany()
+ {
+ // Arrange
+ var content = Fixture.Create();
+ var count = Fixture.Create();
+
+ Expression> filter = x => x.SomeContent == content;
+
+ Eraser = new Mock();
+
+ Eraser
+ .Setup(x => x.DeleteManyAsync(
+ It.IsAny>>(),
+ It.IsAny(),
+ It.IsAny()))
+ .ReturnsAsync(count);
+
+ // Act
+ var result = await Sut.DeleteManyAsync(filter);
+
+ // Assert
+ result.Should().Be(count);
+ Eraser.Verify(x => x.DeleteManyAsync(filter, null, CancellationToken.None), Times.Once);
+ }
+
+ [Fact]
+ public async Task WithFilterAndCancellationToken_ShouldDeleteMany()
+ {
+ // Arrange
+ var content = Fixture.Create();
+ var count = Fixture.Create();
+ var token = new CancellationToken(true);
+
+ Expression> filter = x => x.SomeContent == content;
+
+ Eraser = new Mock();
+
+ Eraser
+ .Setup(x => x.DeleteManyAsync(
+ It.IsAny>>(),
+ It.IsAny(),
+ It.IsAny()))
+ .ReturnsAsync(count);
+
+ // Act
+ var result = await Sut.DeleteManyAsync(filter, token);
+
+ // Assert
+ result.Should().Be(count);
+ Eraser.Verify(x => x.DeleteManyAsync(filter, null, token), Times.Once);
+ }
+
+ [Fact]
+ public async Task WithFilterAndPartitionKey_ShouldDeleteMany()
+ {
+ // Arrange
+ var content = Fixture.Create();
+ var count = Fixture.Create();
+ var partitionKey = Fixture.Create();
+
+ Expression> filter = x => x.SomeContent == content;
+
+ Eraser = new Mock();
+
+ Eraser
+ .Setup(x => x.DeleteManyAsync(
+ It.IsAny>>(),
+ It.IsAny(),
+ It.IsAny()))
+ .ReturnsAsync(count);
+
+ // Act
+ var result = await Sut.DeleteManyAsync(filter, partitionKey);
+
+ // Assert
+ result.Should().Be(count);
+ Eraser.Verify(x => x.DeleteManyAsync(filter, partitionKey, CancellationToken.None), Times.Once);
+ }
+
+ [Fact]
+ public async Task WithFilterAndPartitionKeyAndCancellationToken_ShouldDeleteMany()
+ {
+ // Arrange
+ var content = Fixture.Create();
+ var count = Fixture.Create();
+ var partitionKey = Fixture.Create();
+ var token = new CancellationToken(true);
+
+ Expression> filter = x => x.SomeContent == content;
+
+ Eraser = new Mock();
+
+ Eraser
+ .Setup(x => x.DeleteManyAsync(
+ It.IsAny>>(),
+ It.IsAny(),
+ It.IsAny()))
+ .ReturnsAsync(count);
+
+ // Act
+ var result = await Sut.DeleteManyAsync(filter, partitionKey, token);
+
+ // Assert
+ result.Should().Be(count);
+ Eraser.Verify(x => x.DeleteManyAsync(filter, partitionKey, token), Times.Once);
+ }
+
+ #region Keyed
+
+ [Fact]
+ public async Task Keyed_WithDocuments_ShouldDeleteMany()
+ {
+ // Arrange
+ var documents = Fixture.CreateMany>().ToList();
+ var count = Fixture.Create();
+ Eraser = new Mock();
+
+ Eraser
+ .Setup(x => x.DeleteManyAsync, int>(It.IsAny>>(), It.IsAny()))
+ .ReturnsAsync(count);
+
+ // Act
+ var result = await Sut.DeleteManyAsync, int>(documents);
+
+ // Assert
+ result.Should().Be(count);
+ Eraser.Verify(x => x.DeleteManyAsync, int>(documents, CancellationToken.None), Times.Once);
+ }
+
+ [Fact]
+ public async Task Keyed_WithDocumentsAndCancellationToken_ShouldDeleteMany()
+ {
+ // Arrange
+ var documents = Fixture.CreateMany>().ToList();
+ var count = Fixture.Create();
+ var cancellationToken = new CancellationToken(true);
+ Eraser = new Mock();
+
+ Eraser
+ .Setup(x => x.DeleteManyAsync, int>(It.IsAny>>(), It.IsAny()))
+ .ReturnsAsync(count);
+
+ // Act
+ var result = await Sut.DeleteManyAsync, int>(documents, cancellationToken);
+
+ // Assert
+ result.Should().Be(count);
+ Eraser.Verify(x => x.DeleteManyAsync, int>(documents, cancellationToken), Times.Once);
+ }
+
+ [Fact]
+ public async Task Keyed_WithFilter_ShouldDeleteMany()
+ {
+ // Arrange
+ var content = Fixture.Create();
+ var count = Fixture.Create();
+
+ Expression, bool>> filter = x => x.SomeContent == content;
+
+ Eraser = new Mock();
+
+ Eraser
+ .Setup(x => x.DeleteManyAsync, int>(
+ It.IsAny, bool>>>(),
+ It.IsAny(),
+ It.IsAny()))
+ .ReturnsAsync(count);
+
+ // Act
+ var result = await Sut.DeleteManyAsync, int>(filter);
+
+ // Assert
+ result.Should().Be(count);
+ Eraser.Verify(x => x.DeleteManyAsync, int>(filter, null, CancellationToken.None), Times.Once);
+ }
+
+ [Fact]
+ public async Task Keyed_WithFilterAndCancellationToken_ShouldDeleteMany()
+ {
+ // Arrange
+ var content = Fixture.Create();
+ var count = Fixture.Create();
+ var token = new CancellationToken(true);
+
+ Expression, bool>> filter = x => x.SomeContent == content;
+
+ Eraser = new Mock();
+
+ Eraser
+ .Setup(x => x.DeleteManyAsync, int>(
+ It.IsAny, bool>>>(),
+ It.IsAny(),
+ It.IsAny()))
+ .ReturnsAsync(count);
+
+ // Act
+ var result = await Sut.DeleteManyAsync, int>(filter, token);
+
+ // Assert
+ result.Should().Be(count);
+ Eraser.Verify(x => x.DeleteManyAsync, int>(filter, null, token), Times.Once);
+ }
+
+ [Fact]
+ public async Task Keyed_WithFilterAndPartitionKey_ShouldDeleteMany()
+ {
+ // Arrange
+ var content = Fixture.Create();
+ var count = Fixture.Create();
+ var partitionKey = Fixture.Create();
+
+ Expression, bool>> filter = x => x.SomeContent == content;
+
+ Eraser = new Mock();
+
+ Eraser
+ .Setup(x => x.DeleteManyAsync, int>(
+ It.IsAny, bool>>>(),
+ It.IsAny(),
+ It.IsAny()))
+ .ReturnsAsync(count);
+
+ // Act
+ var result = await Sut.DeleteManyAsync, int>(filter, partitionKey);
+
+ // Assert
+ result.Should().Be(count);
+ Eraser.Verify(x => x.DeleteManyAsync, int>(filter, partitionKey, CancellationToken.None), Times.Once);
+ }
+
+ [Fact]
+ public async Task Keyed_WithFilterAndPartitionKeyAndCancellationToken_ShouldDeleteMany()
+ {
+ // Arrange
+ var content = Fixture.Create();
+ var count = Fixture.Create();
+ var partitionKey = Fixture.Create();
+ var token = new CancellationToken(true);
+
+ Expression, bool>> filter = x => x.SomeContent == content;
+
+ Eraser = new Mock();
+
+ Eraser
+ .Setup(x => x.DeleteManyAsync, int>(
+ It.IsAny, bool>>>(),
+ It.IsAny(),
+ It.IsAny()))
+ .ReturnsAsync(count);
+
+ // Act
+ var result = await Sut.DeleteManyAsync, int>(filter, partitionKey, token);
+
+ // Assert
+ result.Should().Be(count);
+ Eraser.Verify(x => x.DeleteManyAsync