diff --git a/samples/Sample.API/Sample.API.csproj b/samples/Sample.API/Sample.API.csproj
index 238cea9..b9ba048 100644
--- a/samples/Sample.API/Sample.API.csproj
+++ b/samples/Sample.API/Sample.API.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/samples/Sample.Domain/Sample.Domain.csproj b/samples/Sample.Domain/Sample.Domain.csproj
index 9cae353..e56f279 100644
--- a/samples/Sample.Domain/Sample.Domain.csproj
+++ b/samples/Sample.Domain/Sample.Domain.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/src/Fluxera.Repository.Abstractions/Fluxera.Repository.Abstractions.csproj b/src/Fluxera.Repository.Abstractions/Fluxera.Repository.Abstractions.csproj
index fd0ba11..33e5f96 100644
--- a/src/Fluxera.Repository.Abstractions/Fluxera.Repository.Abstractions.csproj
+++ b/src/Fluxera.Repository.Abstractions/Fluxera.Repository.Abstractions.csproj
@@ -29,11 +29,11 @@
-
-
+
+
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Fluxera.Repository.EntityFrameworkCore/EntityTypeBuilderExtensions.cs b/src/Fluxera.Repository.EntityFrameworkCore/EntityTypeBuilderExtensions.cs
index 161755e..cbe3ceb 100644
--- a/src/Fluxera.Repository.EntityFrameworkCore/EntityTypeBuilderExtensions.cs
+++ b/src/Fluxera.Repository.EntityFrameworkCore/EntityTypeBuilderExtensions.cs
@@ -67,8 +67,8 @@ public static void UseStronglyTypedIdValueGenerator(this EntityTypeBuilder entit
}
///
- /// Configure the to use the for
- /// string IDs.
+ /// Configure the to use the
+ /// for string IDs.
///
///
public static void UseSequentialGuidStringIdValueGenerator(this EntityTypeBuilder entityTypeBuilder)
@@ -89,7 +89,7 @@ public static void UseSequentialGuidStringIdValueGenerator(this EntityTypeBuilde
}
///
- /// Disables the delete cascading for references aggregate roots.
+ /// Disables delete cascading for references aggregate roots.
///
///
public static void UseReferences(this EntityTypeBuilder entityTypeBuilder)
diff --git a/src/Fluxera.Repository.EntityFrameworkCore/Fluxera.Repository.EntityFrameworkCore.csproj b/src/Fluxera.Repository.EntityFrameworkCore/Fluxera.Repository.EntityFrameworkCore.csproj
index fb4eb1a..4e4764f 100644
--- a/src/Fluxera.Repository.EntityFrameworkCore/Fluxera.Repository.EntityFrameworkCore.csproj
+++ b/src/Fluxera.Repository.EntityFrameworkCore/Fluxera.Repository.EntityFrameworkCore.csproj
@@ -22,10 +22,10 @@
-
+
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Fluxera.Repository.EntityFrameworkCore/StronglyTypedIdValueGenerator.cs b/src/Fluxera.Repository.EntityFrameworkCore/StronglyTypedIdValueGenerator.cs
index 0feff7b..a9ae395 100644
--- a/src/Fluxera.Repository.EntityFrameworkCore/StronglyTypedIdValueGenerator.cs
+++ b/src/Fluxera.Repository.EntityFrameworkCore/StronglyTypedIdValueGenerator.cs
@@ -10,7 +10,7 @@
[PublicAPI]
public class StronglyTypedIdValueGenerator : ValueGenerator
where TStronglyTypedId : StronglyTypedId
- where TValue : IComparable
+ where TValue : IComparable, IComparable, IEquatable
{
private readonly SequentialGuidValueGenerator sequentialGuidValueGenerator = new SequentialGuidValueGenerator();
@@ -32,12 +32,12 @@ public override TStronglyTypedId Next(EntityEntry entry)
if(typeof(TValue) == typeof(string))
{
Guid guid = this.sequentialGuidValueGenerator.Next(entry);
- result = Activator.CreateInstance(typeof(TStronglyTypedId), new object[] { guid.ToString("D") });
+ result = Activator.CreateInstance(typeof(TStronglyTypedId), [guid.ToString("D")]);
}
else if(typeof(TValue) == typeof(Guid))
{
Guid guid = this.sequentialGuidValueGenerator.Next(entry);
- result = Activator.CreateInstance(typeof(TStronglyTypedId), new object[] { guid });
+ result = Activator.CreateInstance(typeof(TStronglyTypedId), [guid]);
}
else
{
diff --git a/src/Fluxera.Repository.InMemory/InMemoryRepository.cs b/src/Fluxera.Repository.InMemory/InMemoryRepository.cs
index 798d7da..9eba70e 100644
--- a/src/Fluxera.Repository.InMemory/InMemoryRepository.cs
+++ b/src/Fluxera.Repository.InMemory/InMemoryRepository.cs
@@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
+ using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Fluxera.Entity;
@@ -408,7 +409,7 @@ private TKey GenerateKey()
{
Type valueType = keyType.GetStronglyTypedIdValueType();
object value = this.GenerateKey(valueType);
- object key = Activator.CreateInstance(typeof(TKey), new object[] { value });
+ object key = Activator.CreateInstance(typeof(TKey), [value]);
return (TKey)key;
}
@@ -430,18 +431,22 @@ private object GenerateKey(Type keyType)
if(keyType == typeof(int))
{
- IStronglyTypedId pkValue = this.Store.LastOrDefault().Key as IStronglyTypedId;
+ TKey key = this.Store.LastOrDefault().Key;
+ PropertyInfo property = typeof(TKey).GetProperty("Value");
+ int? value = property?.GetValue(key) as int?;
- int nextInt = (pkValue?.Value ?? 0) + 1;
- return nextInt;
+ int next = (value ?? 0) + 1;
+ return next;
}
if(keyType == typeof(long))
{
- IStronglyTypedId pkValue = this.Store.LastOrDefault().Key as IStronglyTypedId;
+ TKey key = this.Store.LastOrDefault().Key;
+ PropertyInfo property = typeof(TKey).GetProperty("Value");
+ long? value = property?.GetValue(key) as int?;
- long nextInt = (pkValue?.Value ?? 0) + 1;
- return nextInt;
+ long next = (value ?? 0) + 1;
+ return next;
}
throw new InvalidOperationException("A key could not be generated. The in-memory repository only supports guid, string, int and long for keys.");
diff --git a/src/Fluxera.Repository.LiteDB/BsonMapperExtensions.cs b/src/Fluxera.Repository.LiteDB/BsonMapperExtensions.cs
index c69d03d..dbe77fb 100644
--- a/src/Fluxera.Repository.LiteDB/BsonMapperExtensions.cs
+++ b/src/Fluxera.Repository.LiteDB/BsonMapperExtensions.cs
@@ -34,7 +34,6 @@ public static BsonMapper UseRepositoryDefaults(this BsonMapper bsonMapper)
Guard.Against.Null(bsonMapper);
bsonMapper.UseSpatial();
- //mapper.UseTemporal();
bsonMapper.UseEnumeration();
bsonMapper.UsePrimitiveValueObject();
bsonMapper.UseStronglyTypedId();
@@ -63,7 +62,7 @@ public static BsonMapper UseReferences(this BsonMapper bsonMapper)
foreach(Type aggregateRootType in aggregateRootTypes)
{
- object entityBuilder = entityMethod?.MakeGenericMethod(aggregateRootType).Invoke(bsonMapper, Array.Empty
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Fluxera.Repository.LiteDB/LiteContext.cs b/src/Fluxera.Repository.LiteDB/LiteContext.cs
index 866f155..200abac 100644
--- a/src/Fluxera.Repository.LiteDB/LiteContext.cs
+++ b/src/Fluxera.Repository.LiteDB/LiteContext.cs
@@ -106,7 +106,7 @@ protected override void DisposeManaged()
}
///
- /// Configures the options to use for this context instance over it's lifetime.
+ /// Configures the options to use for this context instance over its lifetime.
///
protected abstract void ConfigureOptions(LiteContextOptions options);
diff --git a/src/Fluxera.Repository.LiteDB/LiteRepository.cs b/src/Fluxera.Repository.LiteDB/LiteRepository.cs
index e204793..3628812 100644
--- a/src/Fluxera.Repository.LiteDB/LiteRepository.cs
+++ b/src/Fluxera.Repository.LiteDB/LiteRepository.cs
@@ -443,7 +443,7 @@ private TKey GenerateKey()
"A key could not be generated. The LiteDB repository only supports guid or string as type for strongly-typed keys.");
}
- object instance = Activator.CreateInstance(keyType, new object[] { keyValue });
+ object instance = Activator.CreateInstance(keyType, [keyValue]);
return (TKey)instance;
}
diff --git a/src/Fluxera.Repository.LiteDB/RepositoryBuilderExtensions.cs b/src/Fluxera.Repository.LiteDB/RepositoryBuilderExtensions.cs
index 34881ed..1486b39 100644
--- a/src/Fluxera.Repository.LiteDB/RepositoryBuilderExtensions.cs
+++ b/src/Fluxera.Repository.LiteDB/RepositoryBuilderExtensions.cs
@@ -44,7 +44,7 @@ public static IRepositoryBuilder AddLiteRepository(this IRepositoryBuilder build
///
/// Adds a LiteDB repository for the given repository name. The repository options
/// are configured using the options builder configure action. Additional LiteDB
- /// related mappings can be configures using the mapper configuration action.
+ /// related mappings can be configured using the mapper configuration action.
///
///
///
diff --git a/src/Fluxera.Repository.MongoDB/Fluxera.Repository.MongoDB.csproj b/src/Fluxera.Repository.MongoDB/Fluxera.Repository.MongoDB.csproj
index 59b4ea0..3b29263 100644
--- a/src/Fluxera.Repository.MongoDB/Fluxera.Repository.MongoDB.csproj
+++ b/src/Fluxera.Repository.MongoDB/Fluxera.Repository.MongoDB.csproj
@@ -27,10 +27,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Fluxera.Repository.MongoDB/Serialization/Conventions/ReferenceConvention.cs b/src/Fluxera.Repository.MongoDB/Serialization/Conventions/ReferenceConvention.cs
index 3dd6b80..b4e2809 100644
--- a/src/Fluxera.Repository.MongoDB/Serialization/Conventions/ReferenceConvention.cs
+++ b/src/Fluxera.Repository.MongoDB/Serialization/Conventions/ReferenceConvention.cs
@@ -37,7 +37,7 @@ public void Apply(BsonMemberMap memberMap)
Type serializerTypeTemplate = typeof(AggregateRootReferenceSerializer<,>);
Type serializerType = serializerTypeTemplate.MakeGenericType(memberType, idType);
- IBsonSerializer serializer = (IBsonSerializer)Activator.CreateInstance(serializerType, new object[] { referenceSerializer });
+ IBsonSerializer serializer = (IBsonSerializer)Activator.CreateInstance(serializerType, [referenceSerializer]);
memberMap.SetSerializer(serializer);
}
@@ -57,7 +57,7 @@ public void Apply(BsonMemberMap memberMap)
Type serializerTypeTemplate = typeof(AggregateRootReferenceSerializer<,>);
Type serializerType = serializerTypeTemplate.MakeGenericType(elementType, idType);
- IBsonSerializer aggregateRootSerializer = (IBsonSerializer)Activator.CreateInstance(serializerType, new object[] { referenceSerializer });
+ IBsonSerializer aggregateRootSerializer = (IBsonSerializer)Activator.CreateInstance(serializerType, [referenceSerializer]);
serializer = listSerializer.WithChildSerializer(aggregateRootSerializer);
memberMap.SetSerializer(serializer);
@@ -88,7 +88,7 @@ private IBsonSerializer GetReferenceSerializer(Type memberType, string databaseN
Type serializerTypeTemplate = typeof(StronglyTypedIdReferenceSerializer<,>);
Type serializerType = serializerTypeTemplate.MakeGenericType(memberType, valueType);
- serializer = (IBsonSerializer)Activator.CreateInstance(serializerType, new object[] { databaseName, collectionName });
+ serializer = (IBsonSerializer)Activator.CreateInstance(serializerType, [databaseName, collectionName]);
}
else
{
diff --git a/src/Fluxera.Repository.MongoDB/Serialization/Serializers/StronglyTypedIdReferenceSerializer.cs b/src/Fluxera.Repository.MongoDB/Serialization/Serializers/StronglyTypedIdReferenceSerializer.cs
index ac3e14b..e3bd8ed 100644
--- a/src/Fluxera.Repository.MongoDB/Serialization/Serializers/StronglyTypedIdReferenceSerializer.cs
+++ b/src/Fluxera.Repository.MongoDB/Serialization/Serializers/StronglyTypedIdReferenceSerializer.cs
@@ -11,7 +11,7 @@
///
public class StronglyTypedIdReferenceSerializer : SerializerBase
where TStronglyTypedId : StronglyTypedId
- where TValue : notnull, IComparable
+ where TValue : IComparable, IComparable, IEquatable
{
private readonly IBsonSerializer serializer;
@@ -50,7 +50,7 @@ public override TStronglyTypedId Deserialize(BsonDeserializationContext context,
if(value is not null)
{
- id = (TStronglyTypedId)Activator.CreateInstance(typeof(TStronglyTypedId), new object[] { value });
+ id = (TStronglyTypedId)Activator.CreateInstance(typeof(TStronglyTypedId), [value]);
}
return id;
diff --git a/src/Fluxera.Repository.MongoDB/Serialization/StronglyTypedIdGenerator.cs b/src/Fluxera.Repository.MongoDB/Serialization/StronglyTypedIdGenerator.cs
index b36ac71..92bd8a5 100644
--- a/src/Fluxera.Repository.MongoDB/Serialization/StronglyTypedIdGenerator.cs
+++ b/src/Fluxera.Repository.MongoDB/Serialization/StronglyTypedIdGenerator.cs
@@ -6,7 +6,7 @@
using global::MongoDB.Bson.Serialization.IdGenerators;
///
- /// Represents an Id generator for strongly-typed IDs.
+ /// An for strongly-typed IDs.
///
public class StronglyTypedIdGenerator : IIdGenerator
{
@@ -44,7 +44,7 @@ public object GenerateId(object container, object document)
}
}
- object id = Activator.CreateInstance(this.idType, new object[] { value });
+ object id = Activator.CreateInstance(this.idType, [value]);
return id;
}
diff --git a/src/Fluxera.Repository/Fluxera.Repository.csproj b/src/Fluxera.Repository/Fluxera.Repository.csproj
index 33577ff..bf1d3e7 100644
--- a/src/Fluxera.Repository/Fluxera.Repository.csproj
+++ b/src/Fluxera.Repository/Fluxera.Repository.csproj
@@ -27,16 +27,16 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Fluxera.Repository/Options/InterceptionOptionsBuilder.cs b/src/Fluxera.Repository/Options/InterceptionOptionsBuilder.cs
index bc5622f..fa7db42 100644
--- a/src/Fluxera.Repository/Options/InterceptionOptionsBuilder.cs
+++ b/src/Fluxera.Repository/Options/InterceptionOptionsBuilder.cs
@@ -21,7 +21,7 @@ public InterceptionOptionsBuilder(IServiceCollection services)
///
public IInterceptionOptionsBuilder AddInterceptorsFromAssemblies(IEnumerable assemblies)
{
- assemblies ??= Enumerable.Empty();
+ assemblies ??= [];
foreach(Assembly assembly in assemblies)
{
diff --git a/src/Fluxera.Repository/Options/RepositoryOptionsBuilder.cs b/src/Fluxera.Repository/Options/RepositoryOptionsBuilder.cs
index 335b6ad..c26e96b 100644
--- a/src/Fluxera.Repository/Options/RepositoryOptionsBuilder.cs
+++ b/src/Fluxera.Repository/Options/RepositoryOptionsBuilder.cs
@@ -27,7 +27,7 @@ public RepositoryOptionsBuilder(IServiceCollection services, string repositoryNa
public IRepositoryOptionsBuilder UseFor(IEnumerable assemblies)
{
- assemblies ??= Enumerable.Empty();
+ assemblies ??= [];
foreach(Assembly assembly in assemblies)
{
@@ -54,7 +54,7 @@ public IRepositoryOptionsBuilder UseFor(Assembly assembly)
public IRepositoryOptionsBuilder UseFor(IEnumerable types)
{
- types ??= Enumerable.Empty();
+ types ??= [];
foreach(Type type in types)
{
diff --git a/tests/Fluxera.Repository.EntityFrameworkCore.IntegrationTests/AddTests.cs b/tests/Fluxera.Repository.EntityFrameworkCore.IntegrationTests/AddTests.cs
index 4fe937e..2d6d6a7 100644
--- a/tests/Fluxera.Repository.EntityFrameworkCore.IntegrationTests/AddTests.cs
+++ b/tests/Fluxera.Repository.EntityFrameworkCore.IntegrationTests/AddTests.cs
@@ -24,7 +24,7 @@ protected override void AddRepositoryUnderTest(IRepositoryBuilder repositoryBuil
repositoryBuilder.AddEntityFrameworkRepository(repositoryName, configureOptions.Invoke);
}
- // TODO: Add Invoice/InvoiceItem tests here to check if referenced entites are add/updated
+ // TODO: Add Invoice/InvoiceItem tests here to check if referenced entities are add/updated
//[Test]
//public async Task ShouldAddEntity()
//{
diff --git a/tests/Fluxera.Repository.UnitTests.Core/AddTestBase.cs b/tests/Fluxera.Repository.UnitTests.Core/AddTestBase.cs
index 46e9be2..757de93 100644
--- a/tests/Fluxera.Repository.UnitTests.Core/AddTestBase.cs
+++ b/tests/Fluxera.Repository.UnitTests.Core/AddTestBase.cs
@@ -55,7 +55,7 @@ public async Task ShouldAddItem()
public async Task ShouldAddItems()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester"
@@ -64,7 +64,7 @@ public async Task ShouldAddItems()
{
Name = "Tester"
}
- };
+ ];
await this.PersonRepository.AddRangeAsync(persons);
await this.UnitOfWork.SaveChangesAsync();
@@ -98,7 +98,7 @@ public async Task ShouldAddItemWithStronglyTypedId()
public async Task ShouldAddItemsStronglyTypedId()
{
Employee[] employees =
- {
+ [
new Employee
{
Name = "Tester"
@@ -107,7 +107,7 @@ public async Task ShouldAddItemsStronglyTypedId()
{
Name = "Tester"
}
- };
+ ];
await this.EmployeeRepository.AddRangeAsync(employees);
await this.UnitOfWork.SaveChangesAsync();
diff --git a/tests/Fluxera.Repository.UnitTests.Core/AggregateTestBase.cs b/tests/Fluxera.Repository.UnitTests.Core/AggregateTestBase.cs
index f3f6e07..d7d9bda 100644
--- a/tests/Fluxera.Repository.UnitTests.Core/AggregateTestBase.cs
+++ b/tests/Fluxera.Repository.UnitTests.Core/AggregateTestBase.cs
@@ -22,7 +22,7 @@ protected AggregateTestBase(bool isUnitOfWorkEnabled)
public async Task ShouldCount()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester12"
@@ -35,7 +35,7 @@ public async Task ShouldCount()
{
Name = "Tester32"
}
- };
+ ];
await this.PersonRepository.AddRangeAsync(persons);
await this.UnitOfWork.SaveChangesAsync();
@@ -49,7 +49,7 @@ public async Task ShouldCount()
public async Task ShouldCountWithPredicate()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester12"
@@ -62,7 +62,7 @@ public async Task ShouldCountWithPredicate()
{
Name = "Tester32"
}
- };
+ ];
await this.PersonRepository.AddRangeAsync(persons);
await this.UnitOfWork.SaveChangesAsync();
@@ -76,7 +76,7 @@ public async Task ShouldCountWithPredicate()
public async Task ShouldCountWithSpecification()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester12"
@@ -89,7 +89,7 @@ public async Task ShouldCountWithSpecification()
{
Name = "Tester32"
}
- };
+ ];
await this.PersonRepository.AddRangeAsync(persons);
await this.UnitOfWork.SaveChangesAsync();
@@ -103,7 +103,7 @@ public async Task ShouldCountWithSpecification()
public async Task ShouldCountWithStronglyTypedId()
{
Employee[] employees =
- {
+ [
new Employee
{
Name = "Tester12"
@@ -116,7 +116,7 @@ public async Task ShouldCountWithStronglyTypedId()
{
Name = "Tester32"
}
- };
+ ];
await this.EmployeeRepository.AddRangeAsync(employees);
await this.UnitOfWork.SaveChangesAsync();
@@ -131,7 +131,7 @@ public async Task ShouldCountWithStronglyTypedId()
public async Task ShouldCountWithPredicateWithStronglyTypedId()
{
Employee[] employees =
- {
+ [
new Employee
{
Name = "Tester12"
@@ -144,7 +144,7 @@ public async Task ShouldCountWithPredicateWithStronglyTypedId()
{
Name = "Tester32"
}
- };
+ ];
await this.EmployeeRepository.AddRangeAsync(employees);
await this.UnitOfWork.SaveChangesAsync();
@@ -1060,7 +1060,7 @@ public async Task ShouldAverageNullableDoubleWithSpecification()
private Employee[] GetSumEmployees()
{
Employee[] employees =
- {
+ [
new Employee
{
Name = "Tester12",
@@ -1103,7 +1103,7 @@ private Employee[] GetSumEmployees()
SalaryNullableFloat = 5_500,
SalaryNullableDouble = 5_500
}
- };
+ ];
return employees;
}
diff --git a/tests/Fluxera.Repository.UnitTests.Core/FindTestBase.cs b/tests/Fluxera.Repository.UnitTests.Core/FindTestBase.cs
index 99793d8..c3d852a 100644
--- a/tests/Fluxera.Repository.UnitTests.Core/FindTestBase.cs
+++ b/tests/Fluxera.Repository.UnitTests.Core/FindTestBase.cs
@@ -22,7 +22,7 @@ protected FindTestBase(bool isUnitOfWorkEnabled)
public async Task ShouldFindOne()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester1"
@@ -35,7 +35,7 @@ public async Task ShouldFindOne()
{
Name = "Tester3"
}
- };
+ ];
await this.PersonRepository.AddRangeAsync(persons);
await this.UnitOfWork.SaveChangesAsync();
@@ -50,7 +50,7 @@ public async Task ShouldFindOne()
public async Task ShouldFindOneWithSelector()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester1"
@@ -63,7 +63,7 @@ public async Task ShouldFindOneWithSelector()
{
Name = "Tester3"
}
- };
+ ];
await this.PersonRepository.AddRangeAsync(persons);
await this.UnitOfWork.SaveChangesAsync();
@@ -78,7 +78,7 @@ public async Task ShouldFindOneWithSelector()
public async Task ShouldExistsByPredicate()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester1"
@@ -91,7 +91,7 @@ public async Task ShouldExistsByPredicate()
{
Name = "Tester3"
}
- };
+ ];
await this.PersonRepository.AddRangeAsync(persons);
await this.UnitOfWork.SaveChangesAsync();
@@ -105,7 +105,7 @@ public async Task ShouldExistsByPredicate()
public async Task ShouldFindManyWithPredicate()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester12"
@@ -118,7 +118,7 @@ public async Task ShouldFindManyWithPredicate()
{
Name = "Tester32"
}
- };
+ ];
await this.PersonRepository.AddRangeAsync(persons);
await this.UnitOfWork.SaveChangesAsync();
@@ -139,7 +139,7 @@ public async Task ShouldFindManyWithPredicate()
public async Task ShouldFindManyWithSelector()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester12"
@@ -152,7 +152,7 @@ public async Task ShouldFindManyWithSelector()
{
Name = "Tester32"
}
- };
+ ];
await this.PersonRepository.AddRangeAsync(persons);
await this.UnitOfWork.SaveChangesAsync();
@@ -173,7 +173,7 @@ public async Task ShouldFindManyWithSelector()
public async Task ShouldFindOneWithStronglyTypedId()
{
Employee[] employees =
- {
+ [
new Employee
{
Name = "Tester1"
@@ -186,7 +186,7 @@ public async Task ShouldFindOneWithStronglyTypedId()
{
Name = "Tester3"
}
- };
+ ];
await this.EmployeeRepository.AddRangeAsync(employees);
await this.UnitOfWork.SaveChangesAsync();
@@ -202,7 +202,7 @@ public async Task ShouldFindOneWithStronglyTypedId()
public async Task ShouldFindOneWithSelectorWithStronglyTypedId()
{
Employee[] employees =
- {
+ [
new Employee
{
Name = "Tester1"
@@ -215,7 +215,7 @@ public async Task ShouldFindOneWithSelectorWithStronglyTypedId()
{
Name = "Tester3"
}
- };
+ ];
await this.EmployeeRepository.AddRangeAsync(employees);
await this.UnitOfWork.SaveChangesAsync();
@@ -231,7 +231,7 @@ public async Task ShouldFindOneWithSelectorWithStronglyTypedId()
public async Task ShouldExistsByPredicateWithStronglyTypedId()
{
Employee[] employees =
- {
+ [
new Employee
{
Name = "Tester1"
@@ -244,7 +244,7 @@ public async Task ShouldExistsByPredicateWithStronglyTypedId()
{
Name = "Tester3"
}
- };
+ ];
await this.EmployeeRepository.AddRangeAsync(employees);
await this.UnitOfWork.SaveChangesAsync();
@@ -259,7 +259,7 @@ public async Task ShouldExistsByPredicateWithStronglyTypedId()
public async Task ShouldFindManyWithPredicateWithStronglyTypedId()
{
Employee[] employees =
- {
+ [
new Employee
{
Name = "Tester12"
@@ -272,7 +272,7 @@ public async Task ShouldFindManyWithPredicateWithStronglyTypedId()
{
Name = "Tester32"
}
- };
+ ];
await this.EmployeeRepository.AddRangeAsync(employees);
await this.UnitOfWork.SaveChangesAsync();
@@ -295,7 +295,7 @@ public async Task ShouldFindManyWithPredicateWithStronglyTypedId()
public async Task ShouldFindManyWithSelectorWithStronglyTypedId()
{
Employee[] employees =
- {
+ [
new Employee
{
Name = "Tester12"
@@ -308,7 +308,7 @@ public async Task ShouldFindManyWithSelectorWithStronglyTypedId()
{
Name = "Tester32"
}
- };
+ ];
await this.EmployeeRepository.AddRangeAsync(employees);
await this.UnitOfWork.SaveChangesAsync();
diff --git a/tests/Fluxera.Repository.UnitTests.Core/RemoveTestBase.cs b/tests/Fluxera.Repository.UnitTests.Core/RemoveTestBase.cs
index 2f4634b..c45517b 100644
--- a/tests/Fluxera.Repository.UnitTests.Core/RemoveTestBase.cs
+++ b/tests/Fluxera.Repository.UnitTests.Core/RemoveTestBase.cs
@@ -87,7 +87,7 @@ public async Task ShouldRemoveItemByPredicate()
public async Task ShouldRemoveItems()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester"
@@ -104,7 +104,7 @@ public async Task ShouldRemoveItems()
{
Name = "Tester"
}
- };
+ ];
await this.PersonRepository.AddRangeAsync(persons);
await this.UnitOfWork.SaveChangesAsync();
@@ -127,7 +127,7 @@ public async Task ShouldRemoveItems()
public async Task ShouldRemoveItemsByPredicate()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester"
@@ -144,7 +144,7 @@ public async Task ShouldRemoveItemsByPredicate()
{
Name = "Tester"
}
- };
+ ];
await this.PersonRepository.AddRangeAsync(persons);
await this.UnitOfWork.SaveChangesAsync();
@@ -236,7 +236,7 @@ public async Task ShouldRemoveItemByPredicateWithStronglyTypedId()
public async Task ShouldRemoveItemsWithStronglyTypedId()
{
Employee[] employees =
- {
+ [
new Employee
{
Name = "Tester"
@@ -253,7 +253,7 @@ public async Task ShouldRemoveItemsWithStronglyTypedId()
{
Name = "Tester"
}
- };
+ ];
await this.EmployeeRepository.AddRangeAsync(employees);
await this.UnitOfWork.SaveChangesAsync();
diff --git a/tests/Fluxera.Repository.UnitTests.Core/SortingTestBase.cs b/tests/Fluxera.Repository.UnitTests.Core/SortingTestBase.cs
index ee83598..07d9fad 100644
--- a/tests/Fluxera.Repository.UnitTests.Core/SortingTestBase.cs
+++ b/tests/Fluxera.Repository.UnitTests.Core/SortingTestBase.cs
@@ -23,7 +23,7 @@ protected SortingTestBase(bool isUnitOfWorkEnabled)
public async Task ShouldSortByPrimary()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Julie",
@@ -53,8 +53,8 @@ public async Task ShouldSortByPrimary()
{
Name = "Peter",
Age = 52,
- },
- };
+ }
+ ];
await this.PersonRepository.AddRangeAsync(persons);
await this.UnitOfWork.SaveChangesAsync();
@@ -82,7 +82,7 @@ public async Task ShouldSortByPrimary()
public virtual async Task ShouldSortByPrimaryAndSecondary()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Julie",
@@ -107,8 +107,8 @@ public virtual async Task ShouldSortByPrimaryAndSecondary()
{
Name = "Peter",
Age = 52,
- },
- };
+ }
+ ];
await this.PersonRepository.AddRangeAsync(persons);
await this.UnitOfWork.SaveChangesAsync();
@@ -145,7 +145,7 @@ public virtual async Task ShouldSortByPrimaryAndSecondary()
public async Task ShouldSortByDescendingPrimary()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Julie",
@@ -175,8 +175,8 @@ public async Task ShouldSortByDescendingPrimary()
{
Name = "Peter",
Age = 52,
- },
- };
+ }
+ ];
await this.PersonRepository.AddRangeAsync(persons);
await this.UnitOfWork.SaveChangesAsync();
@@ -204,7 +204,7 @@ public async Task ShouldSortByDescendingPrimary()
public virtual async Task ShouldSortByPrimaryAndSecondaryDescending()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Julie",
@@ -229,8 +229,8 @@ public virtual async Task ShouldSortByPrimaryAndSecondaryDescending()
{
Name = "Peter",
Age = 52,
- },
- };
+ }
+ ];
await this.PersonRepository.AddRangeAsync(persons);
await this.UnitOfWork.SaveChangesAsync();
diff --git a/tests/Fluxera.Repository.UnitTests.Core/UpdateTestBase.cs b/tests/Fluxera.Repository.UnitTests.Core/UpdateTestBase.cs
index f71a51f..3253c02 100644
--- a/tests/Fluxera.Repository.UnitTests.Core/UpdateTestBase.cs
+++ b/tests/Fluxera.Repository.UnitTests.Core/UpdateTestBase.cs
@@ -66,7 +66,7 @@ public async Task ShouldUpdateItemWithStronglyTypedId()
public async Task ShouldUpdateItemsWithStronglyTypedId()
{
Employee[] employees =
- {
+ [
new Employee
{
Name = "Tester"
@@ -75,7 +75,7 @@ public async Task ShouldUpdateItemsWithStronglyTypedId()
{
Name = "Tester"
}
- };
+ ];
await this.EmployeeRepository.AddRangeAsync(employees);
await this.UnitOfWork.SaveChangesAsync();
@@ -95,7 +95,7 @@ public async Task ShouldUpdateItemsWithStronglyTypedId()
public async Task ShouldUpdateItems()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester"
@@ -104,7 +104,7 @@ public async Task ShouldUpdateItems()
{
Name = "Tester"
}
- };
+ ];
persons.ForEach(x => x.RaiseDomainEvent(new PersonDomainEvent()));
await this.PersonRepository.AddRangeAsync(persons);
diff --git a/tests/Fluxera.Repository.UnitTests/Decorators/CachingRepositoryDecoratorTests.cs b/tests/Fluxera.Repository.UnitTests/Decorators/CachingRepositoryDecoratorTests.cs
index 750590c..f9edef8 100644
--- a/tests/Fluxera.Repository.UnitTests/Decorators/CachingRepositoryDecoratorTests.cs
+++ b/tests/Fluxera.Repository.UnitTests/Decorators/CachingRepositoryDecoratorTests.cs
@@ -39,7 +39,7 @@ private void ShouldHaveUsedStrategy(Func, bool
public async Task Should_AddAsync_Multiple()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester"
@@ -48,7 +48,7 @@ public async Task Should_AddAsync_Multiple()
{
Name = "Tester"
}
- };
+ ];
await this.Repository.AddRangeAsync(persons);
this.ShouldHaveUsedStrategy(x => x.AddMultipleWasCalled);
@@ -149,7 +149,7 @@ public async Task Should_GetAsync_Single_Result()
public async Task Should_RemoveAsync_Multiple_Predicate()
{
Person[] persons =
- {
+ [
new Person
{
ID = Guid.NewGuid(),
@@ -160,7 +160,7 @@ public async Task Should_RemoveAsync_Multiple_Predicate()
ID = Guid.NewGuid(),
Name = "Tester"
}
- };
+ ];
await this.Repository.RemoveRangeAsync(persons);
this.ShouldHaveUsedStrategy(x => x.RemoveMultipleWasCalled);
@@ -190,7 +190,7 @@ public async Task Should_RemoveAsync_Single_Identifier()
public async Task Should_UpdateAsync_Multiple()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester"
@@ -199,7 +199,7 @@ public async Task Should_UpdateAsync_Multiple()
{
Name = "Tester"
}
- };
+ ];
await this.Repository.UpdateRangeAsync(persons);
this.ShouldHaveUsedStrategy(x => x.UpdateMultipleWasCalled);
diff --git a/tests/Fluxera.Repository.UnitTests/Decorators/DomainEventsRepositoryDecoratorTests.cs b/tests/Fluxera.Repository.UnitTests/Decorators/DomainEventsRepositoryDecoratorTests.cs
index 624268a..f012ae7 100644
--- a/tests/Fluxera.Repository.UnitTests/Decorators/DomainEventsRepositoryDecoratorTests.cs
+++ b/tests/Fluxera.Repository.UnitTests/Decorators/DomainEventsRepositoryDecoratorTests.cs
@@ -69,7 +69,7 @@ private Task ShouldHaveUsedDispatcher(bool expected = true)
public async Task Should_AddAsync_Multiple()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester"
@@ -78,7 +78,7 @@ public async Task Should_AddAsync_Multiple()
{
Name = "Tester"
}
- };
+ ];
persons.ForEach(x => x.RaiseDomainEvent(new PersonDomainEvent()));
await this.Repository.AddRangeAsync(persons);
@@ -204,7 +204,7 @@ public async Task Should_RemoveAsync_Single_Identifier()
public async Task Should_UpdateAsync_Multiple()
{
Person[] persons =
- {
+ [
new Person
{
ID = Guid.Parse("8693cbd0-a564-47cf-9fe3-b1444392957d"),
@@ -220,7 +220,7 @@ public async Task Should_UpdateAsync_Multiple()
ID = Guid.Parse("fabb0b65-45c5-4aff-87b0-45b766074588"),
Name = "Tester"
}
- };
+ ];
persons.ForEach(x => x.RaiseDomainEvent(new PersonDomainEvent()));
await this.Repository.UpdateRangeAsync(persons);
diff --git a/tests/Fluxera.Repository.UnitTests/Decorators/ExceptionLoggingRepositoryDecoratorTests.cs b/tests/Fluxera.Repository.UnitTests/Decorators/ExceptionLoggingRepositoryDecoratorTests.cs
index 72627ac..ee9fac8 100644
--- a/tests/Fluxera.Repository.UnitTests/Decorators/ExceptionLoggingRepositoryDecoratorTests.cs
+++ b/tests/Fluxera.Repository.UnitTests/Decorators/ExceptionLoggingRepositoryDecoratorTests.cs
@@ -45,7 +45,7 @@ public async Task ShouldLogException_AddAsync_Multiple()
await this.ShouldLogException(async () =>
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester"
@@ -54,7 +54,7 @@ await this.ShouldLogException(async () =>
{
Name = "Tester"
}
- };
+ ];
await this.Repository.AddRangeAsync(persons);
});
}
@@ -176,7 +176,7 @@ public async Task ShouldLogException_RemoveAsync_Single()
await this.ShouldLogException(async () =>
{
Person[] persons =
- {
+ [
new Person
{
ID = Guid.NewGuid(),
@@ -187,7 +187,7 @@ await this.ShouldLogException(async () =>
ID = Guid.NewGuid(),
Name = "Tester"
}
- };
+ ];
await this.Repository.RemoveRangeAsync(persons);
});
}
@@ -207,7 +207,7 @@ public async Task ShouldLogException_UpdateAsync_Multiple()
await this.ShouldLogException(async () =>
{
Person[] persons =
- {
+ [
new Person
{
ID = Guid.NewGuid(),
@@ -218,7 +218,7 @@ await this.ShouldLogException(async () =>
ID = Guid.NewGuid(),
Name = "Tester"
}
- };
+ ];
await this.Repository.UpdateRangeAsync(persons);
});
}
diff --git a/tests/Fluxera.Repository.UnitTests/Decorators/GuardRepositoryDecoratorTests.cs b/tests/Fluxera.Repository.UnitTests/Decorators/GuardRepositoryDecoratorTests.cs
index e32140b..685ad93 100644
--- a/tests/Fluxera.Repository.UnitTests/Decorators/GuardRepositoryDecoratorTests.cs
+++ b/tests/Fluxera.Repository.UnitTests/Decorators/GuardRepositoryDecoratorTests.cs
@@ -74,7 +74,7 @@ private void ShouldGuardAgainstTransient(Func innerFunc)
public void ShouldGuard_AddAsync_Multiple()
{
Person[] persons =
- {
+ [
new Person
{
ID = Guid.NewGuid(),
@@ -85,7 +85,7 @@ public void ShouldGuard_AddAsync_Multiple()
ID = Guid.NewGuid(),
Name = "Tester"
}
- };
+ ];
this.ShouldGuardAgainstNull(async () => await this.Repository.AddRangeAsync(null));
this.ShouldGuardAgainstNotTransient(async () => await this.Repository.AddRangeAsync(persons));
this.ShouldGuardAgainstDisposed(async () => await this.Repository.AddRangeAsync(persons));
@@ -257,7 +257,7 @@ public void ShouldGuard_RemoveAsync_Single_Identifier()
public void ShouldGuard_UpdateAsync_Multiple()
{
Person[] persons =
- {
+ [
new Person
{
Name = "Tester"
@@ -266,9 +266,9 @@ public void ShouldGuard_UpdateAsync_Multiple()
{
Name = "Tester"
}
- };
+ ];
Person[] validPersons =
- {
+ [
new Person
{
Name = "Tester"
@@ -277,7 +277,7 @@ public void ShouldGuard_UpdateAsync_Multiple()
{
Name = "Tester"
}
- };
+ ];
this.ShouldGuardAgainstNull(async () => await this.Repository.UpdateRangeAsync(null));
this.ShouldGuardAgainstTransient(async () => await this.Repository.UpdateRangeAsync(persons));
this.ShouldGuardAgainstDisposed(async () => await this.Repository.UpdateRangeAsync(validPersons));
diff --git a/tests/Fluxera.Repository.UnitTests/Decorators/ValidationRepositoryDecoratorTests.cs b/tests/Fluxera.Repository.UnitTests/Decorators/ValidationRepositoryDecoratorTests.cs
index 1bef63d..477972b 100644
--- a/tests/Fluxera.Repository.UnitTests/Decorators/ValidationRepositoryDecoratorTests.cs
+++ b/tests/Fluxera.Repository.UnitTests/Decorators/ValidationRepositoryDecoratorTests.cs
@@ -41,10 +41,10 @@ protected override void ConfigureServices(IServiceCollection services)
public void ShouldValidate_AddAsync_Multiple()
{
Person[] persons =
- {
+ [
new Person(),
new Person()
- };
+ ];
ShouldGuardAgainstInvalid(async () => await this.Repository.AddRangeAsync(persons));
}
@@ -58,7 +58,7 @@ public void ShouldValidate_AddAsync_Single()
public void ShouldValidate_UpdateAsync_Multiple()
{
Person[] persons =
- {
+ [
new Person
{
ID = Guid.NewGuid()
@@ -67,7 +67,7 @@ public void ShouldValidate_UpdateAsync_Multiple()
{
ID = Guid.NewGuid()
}
- };
+ ];
ShouldGuardAgainstInvalid(async () => await this.Repository.UpdateRangeAsync(persons));
}
diff --git a/tests/Fluxera.Repository.UnitTests/DomainEventsTestRepository.cs b/tests/Fluxera.Repository.UnitTests/DomainEventsTestRepository.cs
index d544f80..c64d986 100644
--- a/tests/Fluxera.Repository.UnitTests/DomainEventsTestRepository.cs
+++ b/tests/Fluxera.Repository.UnitTests/DomainEventsTestRepository.cs
@@ -21,7 +21,7 @@ public class DomainEventsTestRepository : NoopTestReposito
public override Task> FindManyAsync(ISpecification specification, IQueryOptions queryOptions = null, CancellationToken cancellationToken = default)
{
Person[] persons =
- {
+ [
new Person
{
ID = Guid.Parse("8693cbd0-a564-47cf-9fe3-b1444392957d"),
@@ -37,7 +37,7 @@ public override Task> FindManyAsync(ISpecifi
ID = Guid.Parse("fabb0b65-45c5-4aff-87b0-45b766074588"),
Name = "Tester"
}
- };
+ ];
IReadOnlyCollection items = persons.Cast().AsReadOnly();
return Task.FromResult(items);
}
@@ -46,7 +46,7 @@ public override Task> FindManyAsync(ISpecifi
public override Task> FindManyAsync(Expression> predicate, IQueryOptions queryOptions, CancellationToken cancellationToken)
{
Person[] persons =
- {
+ [
new Person
{
ID = Guid.Parse("8693cbd0-a564-47cf-9fe3-b1444392957d"),
@@ -62,7 +62,7 @@ public override Task> FindManyAsync(Expressi
ID = Guid.Parse("fabb0b65-45c5-4aff-87b0-45b766074588"),
Name = "Tester"
}
- };
+ ];
IReadOnlyCollection items = persons.Cast().AsReadOnly();
return Task.FromResult(items);
}